1. Try the invalid example
Open JSON Formatter using the button above, paste this into Input, and select Format JSON:
{"z":2,"a":1,}The comma after 1 is followed by a closing brace instead of another property. JSON does not permit that trailing comma. Expect an error and disabled result-download controls. The exact error text depends on the browser.
2. Remove the final comma and format again
Replace the input with:
{"z":2,"a":1}Choose 2 spaces, enable Sort object keys, then select Format JSON. The result is:
{
"a": 1,
"z": 2
}You can also download the valid practice JSON and use Open .json file. Sorting changes object-key order, not array-item order.
3. Copy, download, or minify
Select Copy result or Download JSON. To minify the sorted object, paste the sorted result back into Input and select Minify. The compact result is:
{"a":1,"z":2}Editing the input or formatting settings clears the old result. Format again before copying or downloading. Ctrl+Enter or Command+Enter formats from the input field.
Other syntax problems to check
- Use double quotes for property names and string values. Single quotes are not JSON.
- Remove comments; JSON does not support them.
- Check matching braces and brackets, missing colons, and commas between values.
The formatter validates syntax; it does not guess missing values or automatically repair malformed input. Successful parsing does not prove that the data matches your application's schema.
Protect number precision
This tool uses JavaScript JSON parsing. Integers beyond 9007199254740991 can lose precision. Store long identifiers as quoted strings before processing, or use a parser designed for arbitrary-precision numbers. Duplicate object keys are reduced to the last value.
Pasted JSON is not uploaded or included in analytics. The standalone HTML version works without a connection and sends no analytics requests.