JSON Formatter
Paste JSON and it is formatted and checked as you type. Errors are pinpointed and can often be fixed in one click.
The formatted JSON appears here.
Click a key to see its pathHow it works
Paste or drop
Paste JSON into the left box, or drop a .json file anywhere on it. There is no Format button to press: the output updates as you type.
Pick a layout
2 or 4 spaces, tabs, or one minified line. Sort keys to make two documents easy to compare, or turn the JSON into a string for code. Your choices are remembered.
Read, fix, copy
Switch to Tree to fold large documents, search keys and values, and copy the path of any key. If the JSON is broken, the error is shown with its line and column, and common mistakes can be repaired.
Is my JSON uploaded?
No. Formatting, checking and repairing all happen in your browser. The page sends nothing you paste to any server.
- There is no “save online” or share link, so your data cannot end up on a public URL by accident.
- What you paste is not stored, not even in your browser. Only your layout choices (indent, sort keys, view) are remembered.
- You can disconnect from the internet after the page loads and it keeps working.
Questions
Why do my big numbers stay exact here but not in other tools?
Most online formatters read JSON with JavaScript’s JSON.parse, which stores every number as a 64-bit float. IDs such as 12345678901234567890 silently become 12345678901234567000, and 1.10 becomes 1.1.
This page keeps every number exactly as it was written. When a document contains numbers that JavaScript would change, the status line tells you.
What can the automatic repair fix?
Mistakes that are easy to make when copying from code, logs or chat:
- Trailing commas: [1, 2,]
- Comments: // … and /* … */
- Single-quoted strings: 'text'
- Keys without quotes: {name: 1}
- Python values: True, False, None
- Raw line breaks and tabs inside strings
The fixed output is shown with a note listing every change. Nothing replaces your input until you press “Use the fixed version”. A missing comma or bracket is not guessed: the error points at it so you can decide.
My JSON is one long string full of \" — what is that?
That is JSON that was turned into a string, which often happens in logs and API responses (for example "{\"id\":1}"). The page notices it and offers “Unwrap it”, which replaces the input with the JSON inside.
What does “Sort keys” do?
It orders the keys of every object alphabetically, at every level, with natural number order (a2 before a10). Arrays keep their order. It is useful for comparing two documents or for stable diffs in version control.
What is “As a string” for?
It turns the whole JSON into one string, with every " written as \" and line breaks as \n, for example "{\"id\":1}". That is the form you need to put JSON inside code, a test, an environment variable or a field of another JSON document.
It is the reverse of “Unwrap it”. Turn it on, copy, and paste where the string goes. Indent still applies: pick Minify for the shortest string.
How large a file can it handle?
Files of tens of megabytes work. Long output is drawn only where you are looking, so scrolling stays smooth, and the tree opens one level at a time. Because of that, the browser’s find (Ctrl+F) only searches the lines on screen in long output; to find a key or value, use the search box above the tree. Above 20 MB the colours are turned off.