JSON Formatter & Validator
A single missing comma can make an API response unreadable in a log. Paste JSON here to check whether it parses, then format it into something you can actually read.
How to Use
- Paste JSON into the input box, or use Load example for a small starting document.
- Choose Indentation: 2 spaces, 4 spaces, Tab or Minified.
- Click Format / Minify for output, or Validate to check syntax only. JSON `null` is valid input and stays valid.
- Copy output, Download JSON or Clear the tool.
Practical Examples
- {"name":"SmartPixel","tools":30} becomes an indented, multi-line object at 2-space indentation.
- The literal `null` is valid JSON and formats to `null`, not an error.
- A trailing comma such as {"a":1,} fails validation and the message points to the parse position.
Understanding the Result
Formatting runs JSON.parse followed by JSON.stringify with the indentation you chose. Validation runs the parse on its own and reports the browser's error message, including a character position when available. Minified uses no indentation.
Reformatting changes whitespace and escaping, not the underlying data. A number written as 1.0 is displayed as 1 because JSON has one numeric type, and a duplicate key keeps only its last value.
The parser distinguishes a successful parse of `null` from a parse failure, so valid null values are no longer reported as invalid.
Limitations and Useful Notes
- The tool reports syntax errors but does not repair them. Use the position in the message to find the mistake.
- It does not check a schema, data types, required fields or business rules. Valid JSON can still be the wrong shape.
- Formatting normalises the text: numbers may lose trailing zeros and duplicate keys collapse. It is not byte-for-byte preservation.
- Inputs over one million characters are rejected to avoid freezing the browser; split very large documents.
- Nothing is sent to a server, but the JSON stays in the input box only while the page is open.
Common Questions
Is `null` valid JSON?
Yes. A bare `null` is a valid JSON value, and this tool formats it to `null` instead of mistakenly reporting an error.
Does formatting change my data?
Keys, values, order and nesting are preserved. Whitespace, escaping and numeric notation may change: 1.0 becomes 1, and comments are rejected because JSON does not allow them.
Can I use tabs or minified output?
Yes. The Indentation dropdown offers 2 spaces, 4 spaces, Tab and Minified. The same choice controls Format.
Why does Validate pass but my app still reject the JSON?
Validation checks syntax only. Your application may require particular fields, types or a specific structure, which this tool does not inspect.