What this tool checks
JSON looks like JavaScript but is stricter: keys must be double-quoted, trailing commas are not allowed, and values are limited to strings, numbers, booleans, null, objects and arrays. A single misplaced comma or a stray single-quote is enough to break a whole payload, and the resulting error from most languages' JSON parsers only gives a byte offset. This tool converts that into a line and column you can actually find, and beautifies valid JSON so nested structures are easy to read.
Minifying does the opposite: it strips every non-significant space and newline, which is what you want before sending JSON over the wire or pasting it into a field with a size limit.
Example
Paste a compact object:
{"name":"Ada","born":1815,"tags":["math","writer"]}and Format produces:
{
"name": "Ada",
"born": 1815,
"tags": [
"math",
"writer"
]
}Common causes of invalid JSON
- Trailing commas —
{"a": 1,}is valid in JavaScript object literals but not in JSON. - Single-quoted strings or keys — JSON requires double quotes:
{"a": 1}, not{'a': 1}. - Unquoted keys —
{a: 1}needs to be{"a": 1}. - Comments — JSON has no comment syntax;
// like thiswill fail to parse. - NaN, Infinity or undefined — none of these are valid JSON values.
Doing the same thing in code
JavaScript
const pretty = JSON.stringify(JSON.parse(text), null, 2);
const compact = JSON.stringify(JSON.parse(text));Python
import json
pretty = json.dumps(json.loads(text), indent=2)
compact = json.dumps(json.loads(text), separators=(",", ":"))