How to use JSON Formatter
- Paste your JSON on the left, or open a .json file (up to 25 MB). The formatted result appears on the right as you type.
- Pick the indent (2, 4 or tab), tick Sort keys for a stable order, or switch to Minify for the smallest form.
- If the JSON is not valid, read the error with its line and column; the link selects the spot, and Fix it repairs the usual slips.
- Use Tree to fold and count objects and arrays, To YAML or To CSV to convert, then Copy or Download.
Why use JSON Formatter
Errors in plain words
"Line 9, column 12: strings must use double quotes" instead of "Unexpected token". The link jumps to the spot.
Fix it
Trailing commas, single quotes, comments, unquoted keys, Python True/None and a stray byte-order mark are corrected in one tap.
Tree viewer
Fold and unfold objects and arrays with their counts, coloured keys and values, to find your way around a big response.
Convert
JSON to YAML for config files, and an array of objects to CSV for a spreadsheet; minify for the wire.
About this tool
JSON is how APIs, config files and logs carry data, and it is strict: keys in double quotes, no comments, no comma after the last item. Editors and API responses often hand you a wall of it on one line, or something nearly valid copied out of JavaScript or Python. This page beautifies JSON with the indent you choose, validates it with a pointed error message, and, unlike most JSON validators, fixes the common slips for you instead of just naming them.
The parser is our own, so error positions are exact in every browser and the page can say what is wrong in plain words. Large files are handled without freezing the tab, keys can be sorted for a stable diff, and the tree view shows counts at each level. The YAML and CSV conversions cover the everyday cases (config files and arrays of records); nested values in CSV are written as JSON in the cell.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Formatting and validation run in your browser; the page makes no network requests while you work, which is why it is safe for API responses that hold real data.
What does "Fix it" change?
Only the mechanical slips: it removes comments and trailing commas, turns single quotes into double quotes, quotes bare keys, and maps True, False, None, NaN and undefined to JSON values. Your values and their order are kept.
How big a file can it format?
Files up to 25 MB open here. Above about 200 KB the output is shown without colouring, which keeps the page fast.
Can it convert JSON to CSV?
Yes, when the JSON is an array of objects (one object per row) or an array of arrays. Columns are the union of the keys; nested objects are written as JSON in the cell.
Does it keep the order of keys?
Yes, unless you tick Sort keys, which sorts every level alphabetically for a stable comparison.
Is it safe to format JSON online here?
Yes. The JSON is formatted in your browser and never sent to a server, so it is safe for API responses and config files.