JSON Formatter and Validator
Paste unformatted JSON to indent it neatly, or compress it into a single line.
How to use the JSON Formatter and Validator
- Paste the JSON text into the input box. This works on pasted text, not on an uploaded file.
- Use the format button to rewrite it into the output box with two-space indentation.
- Use the minify button for the same data on one line, or the copy button to take the output.
Formatting rewrites the data, not only the spacing
Both buttons parse your text and write it out again, so more than whitespace can change. A key that appears twice keeps only its last value, 1.50 comes back as 1.5 and 2e3 as 2000. Keep the original if the exact bytes matter.
What the error message is telling you
When the text will not parse, the browser's own error is shown and the output box is left untouched. The usual causes are a comma after the last item, keys or strings in single quotes, comments, and values such as NaN or undefined.
Frequently asked questions
What happens with invalid JSON?
You get an error message identifying where the problem is, which is usually faster than hunting for a missing comma by eye.
Is my data uploaded?
No. All processing happens in your browser, so you can safely paste API responses containing sensitive data.
Can I change the indentation?
It is fixed at two spaces in the current version.
Are accented or non-Latin characters escaped?
No. Text comes back as you typed it rather than as escape sequences, in both the formatted and the minified output, so Korean and accented Latin stay readable.
Can I paste several JSON objects at once?
No. One run handles one JSON value, so a file with an object per line will not parse. Wrap those lines in an array first.
Does it keep my key order?
Mostly. Keys stay in the order you wrote them, except that whole-number keys such as 2 and 10 move to the front in numeric order.