JSON Formatter & Validator
Format, validate, and minify JSON data. Features syntax highlighting and error detection.
About the Tool
The rules that make JSON valid
JSON (JavaScript Object Notation) is stricter than people expect. Keys and string values must use double quotes, never single quotes. The only allowed value types are string, number, boolean, null, object and array - so dates and undefined are not valid JSON. Trailing commas after the last item are forbidden, and there is no such thing as a comment in standard JSON.
Pretty-print or minify?
The same data can be written two ways. Pretty-printing adds indentation and line breaks so a human can read the structure at a glance - ideal while debugging. Minifying strips every unnecessary space and newline to make the payload as small as possible - ideal for sending over the network or storing in a database. This tool does both, and validates the input along the way.
The mistakes that break a parse
- A trailing comma after the final property or array element.
- Single quotes instead of double quotes around keys or strings.
- Unquoted keys copied straight from a JavaScript object literal.
- An unescaped quote, backslash or newline inside a string value.
Before and after
// minified - hard to read
{"city":"Cape Town","temp":19,"raining":false}
// formatted - easy to read
{
"city": "Cape Town",
"temp": 19,
"raining": false
}Everything runs in your browser, so even sensitive configuration or API responses you paste here never leave your machine.