About this tool
JSON from an API, a config file or a log is often one unreadable line. Paste it here to indent it into a readable structure, check that it is valid, or squeeze it into the smallest form for transport.
When JSON is invalid, the tool reports the message from your browser's parser together with line and column where possible, and suggests common causes such as trailing commas or single quotes.
How to use the JSON Formatter and Validator
- Paste JSON into the input box, or load the sample.
- Press Format to beautify, Minify to compress, or Validate to only check syntax.
- If an error appears, go to the reported line and column and fix it.
- Copy the result or download it as data.json.
Practical examples
How it works
The tool calls the browser's native JSON.parse. If parsing succeeds, JSON.stringify writes the output with your chosen indentation, or with none for minify. Sorting keys rebuilds each object with keys in alphabetical order.
Errors come from the parser, so wording differs between Chrome, Firefox and Safari. Line and column are derived from the position the parser reports. Standard JSON has no comments, trailing commas, single quotes, undefined or NaN.
Extremely large numbers lose precision because JavaScript stores them as 64-bit floats, which is a limitation of JSON.parse.
Privacy and file processing
Your JSON is processed locally in the browser and is not uploaded or stored.
See our Privacy Policy for details on cookies, local storage and advertising.
Frequently asked questions
Is my JSON sent anywhere?
No. Parsing and formatting happen in your browser.
Why does it say my JSON is invalid when it works in my code editor?
Editors sometimes accept JSON5 or comments. Strict JSON, which this tool checks, does not.
Does formatting change the data?
No, apart from key order if you tick the sort option and number formatting such as 1.0 becoming 1.
Can it handle large files?
Several megabytes work on most devices. Very large files may be slow because the text is shown in a text box.
Related tools
Results are for general information. Check important figures against official sources. Read the disclaimer.