Home › JSON Formatter and Validator
JSON Formatter and Validator
Paste a JSON document to check that it is valid, to indent it so people can read it, or to squeeze it onto one line before sending it in a request.
Results
- Status
- Valid JSON
- Top-level type
- object
- Top-level items
- 4
- Keys (all levels)
- 4
- Nesting depth
- 3
- Size before
- 62 B
- Size after
- 92 B
How it works
The tool parses your text with the same strict parser the browser uses for web APIs. If parsing succeeds, the value is written back with the indentation you chose, so the output is always valid JSON. If it fails, the parser’s own message tells you what it did not expect, which is usually a missing quote, a trailing comma or a stray character.
Rules and details
Valid JSON: keys and strings use double quotes; no comments; no trailing commasAllowed values: object, array, string, number, true, false, nullOutput = JSON.stringify(parsed value, indentation)Size = number of UTF-8 bytes of the text
Worked example
The compact object {"name":"Amina","langs":["en","sw"],"active":true,"score":9.5} takes 62 bytes. Indented with two spaces it takes 92 bytes, and the tool reports 4 keys over 3 levels of nesting. The extra bytes are only spaces and line breaks.
Frequently asked questions
Why do I get “Unexpected token” on JavaScript-style data?
JSON is stricter than JavaScript object syntax. Keys must be in double quotes, strings cannot use single quotes, and comments and trailing commas are not allowed. Fix these and the document validates.
Does formatting change my data?
Not the structure. Key order is kept unless you ask for sorting. Two things can change: duplicate keys collapse to the last one, and integers beyond 9,007,199,254,740,991 lose precision because they are read as ordinary numbers.
Is my JSON uploaded anywhere?
No. Parsing and formatting happen in your browser, so you can safely paste internal payloads, though you should still avoid sharing secrets on a shared computer.
Tips
- Use minified output for request bodies and indented output for code reviews.
- Sorting keys makes two similar documents easy to compare in the text diff tool.
- Large files work, but a very long single line can be slow to scroll: use indentation to read it.