Contact

Tools  /  JSON  /  JSON Formatter

JSON Formatter

Format, validate and minify JSON, with the error located by line.

What this tool does

Paste or upload any JSON and it gets checked, formatted, and made easy to work with. Beyond the basics — format, minify, and validate — this formatter also handles the parts that usually send people to a second tool: fixing JSON that has a small mistake in it, viewing it as a collapsible tree instead of raw text, sorting keys alphabetically, and converting it straight to YAML, CSV, or a TypeScript interface.

Fixing invalid JSON

When JSON fails to parse, the error message usually names a line and column but not much else. This tool locates that line for you and highlights it, so you're not scanning the whole file for one missing comma. For the common mistakes — a trailing comma, single quotes instead of double quotes, an unquoted key — the Try to repair option attempts an automatic fix rather than making you find it by hand.

Converting JSON to something else

Working with an API response usually means turning JSON into whatever format the next step needs:

  • YAML — for config files and most CI/CD pipelines.
  • CSV — for a spreadsheet, when the JSON is an array of objects with the same shape.
  • TypeScript interface — a typed shape generated straight from real data, so you’re not writing it out by hand from an API doc.

Reading and editing the structure

The tree view shows nested objects and arrays as a structure you can collapse and expand, which is faster than reading deeply nested JSON as plain text — useful for a large or unfamiliar payload. Sort keys puts every object's keys in alphabetical order, which makes two JSON files easier to diff. Escape and unescape convert between a JSON string and the string-inside-a-string form you get when JSON has been serialized twice, e.g. logged from a server.

Privacy

Everything happens in your browser. The JSON you paste is never sent to a server — there's no upload step to skip, because there isn't one. That also means it works offline once the page has loaded, and there's no size limit beyond what your browser can hold in memory.

Frequently asked questions

Is my JSON data uploaded anywhere?
No. Formatting, validation, repair and conversion all run locally in your browser with JavaScript — the content never leaves your device or touches a server.
Why does my JSON say it’s invalid when it looks fine?
The most common causes are a trailing comma after the last item in an object or array, single quotes instead of double quotes, or a comment left in the file — standard JSON allows none of these. Click the error to jump straight to the line, or try Try to repair for an automatic fix.
Can it convert JSON to a TypeScript interface?
Yes — the export option generates a TypeScript interface from the shape of your actual JSON data, including nested objects and arrays.
Can I convert JSON to CSV?
Yes, when the JSON is an array of objects that share the same keys — that’s the shape a spreadsheet expects. A deeply nested or mixed-shape array won’t convert cleanly, since CSV has no way to represent nesting.
What is the difference between formatting and minifying?
Formatting adds indentation and line breaks so JSON is easy to read. Minifying strips all of that whitespace, producing the smallest possible version — useful right before sending the JSON over a network, not while you’re working on it.
Is there a size limit?
No fixed limit — since nothing is uploaded, the only ceiling is how much your browser tab can hold in memory. Very large files (tens of megabytes) may be slow to render as a tree, but formatting and validation still work.
Theme Accent