How do I validate and format JSON?
Parse it with a strict JSON parser; if it parses, re-print it with indentation. Paste your JSON here and it is checked and formatted as you type, with the line and column of any error.
- Paste JSON or open a .json file.
- Read the status line: valid, or the error and where it is.
- Pick an indent and whether to sort keys.
- Press Format or Minify.
- Copy or download the result.
Examples
A common error
Input
{"name": "Acme", "seats": 5,}Result
Invalid JSON. Look for a trailing comma before } or ].
Minified
Input
{
"a": 1,
"b": [1, 2]
}Result
{"a":1,"b":[1,2]}
Frequently asked questions
Why is my JSON invalid when it works in JavaScript?
JSON is stricter than JavaScript: keys need double quotes, strings cannot use single quotes, and trailing commas and comments are not allowed.
Does sorting keys change the data?
No. Object key order has no meaning in JSON. Sorting just makes two files easier to compare.
Can it handle large files?
Files of several megabytes are fine. Very large files depend on your device's memory.
Is my JSON sent anywhere?
No. Parsing and formatting happen in your browser.