JSON Formatter
This JSON formatter takes raw, minified or messy JSON and returns it properly indented and readable. It validates as it goes, points at the exact character where the syntax breaks, and can minify the result back down for production.
How to Format and Validate JSON
Paste your JSON into the left panel. If you want to prettify it, click Format. The tool will parse the JSON and output a properly indented version in the right panel, making it easy to read nested structures even in complex API responses.
If there is a syntax error in your JSON, the error box appears with the exact problem description. Common issues are trailing commas after the last item in an array or object, single quotes instead of double quotes around keys, and missing closing brackets. The error message points directly to the first problem found.
To compress your JSON back to a single line for pasting into a config file or API request, click Minify. The output removes all whitespace while keeping the data structure intact.
JSON Syntax Rules
JSON stands for JavaScript Object Notation. The format has a small set of strict rules that must all be followed for the document to be valid.
- Keys must be double-quoted strings: Use "name", not name or 'name'.
- String values must also be double-quoted: Use "value", not 'value'.
- No trailing commas: The last item in an array or object cannot have a comma after it. This is one of the most common mistakes coming from JavaScript code.
- Numbers are unquoted: Write 42, not "42", if you mean a number.
- Booleans and null are lowercase: true, false, null, not True or NULL.
- All brackets must close: Every opening { needs a closing }, and every [ needs a ].
Common JSON Formatting Scenarios
- API response debugging: You receive a minified JSON response from an API endpoint and need to read it. Paste it into this formatter to get an indented, structured view of all nested objects and arrays.
- Config file cleanup: A JSON config file has inconsistent indentation from multiple editors. Paste it in, format it, and copy back a consistently styled version.
- JSON validation before send: You are about to POST a JSON payload to an API. Paste your constructed body here first to confirm there are no syntax errors that would cause a 400 Bad Request response.
- JSON minification for production: Remove whitespace from a large JSON file to reduce its byte size for faster network transfer or smaller storage footprint.
Frequently Asked Questions
Why does my JSON keep showing a validation error?
The most common causes are trailing commas, single-quoted strings, and missing or extra brackets. Check the last item in every array and object to make sure there is no comma after it. Make sure all string values and all keys are wrapped in double quotes, not single quotes. If you copied JSON from a JavaScript file you may need to clean it up since JS allows single quotes and trailing commas but JSON does not.
Is my JSON data sent to a server?
No. This formatter runs entirely in the browser using the native JSON.parse and JSON.stringify methods built into every modern browser. Your data never leaves your device. This makes it safe to format sensitive payloads like API keys or database responses.
What is the difference between JSON and a JavaScript object?
A JavaScript object is code that lives in memory during execution. JSON is a text format for transmitting or storing data. They look similar but have stricter rules: JSON requires double quotes on all keys, does not support trailing commas, and cannot contain functions or undefined values. The JSON.parse and JSON.stringify functions convert between the two.
Can this handle very large JSON files?
The tool handles files up to a few megabytes without issues on modern browsers. Very large JSON documents tens of thousands of lines long may cause a brief pause during formatting but will process correctly. The bottleneck is browser memory, not the tool itself.
Guides for the JSON Formatter
Longer reads on the maths and the practical side of this tool.