JSON formatter
Processed in your browser · nothing is uploaded
Formats JSON with the indent you choose, and tells you exactly where it broke if it will not parse — line and column, not just "invalid".
How to use the json formatter
Almost every rejection comes down to one of three things, and all three are valid JavaScript, which is why they slip through. A trailing comma after the last element is fine in JS and illegal in JSON. Single quotes are fine in JS and illegal in JSON — strings must use double quotes. Unquoted keys are fine in JS and illegal in JSON. Two rarer causes are worth knowing: a byte order mark at the start of a file, which is invisible and breaks the parse on the very first character, and NaN or Infinity, which JavaScript produces happily and JSON cannot represent at all.
Questions
The three usual causes are a trailing comma after the last item, single quotes instead of double, and unquoted keys. All three are valid JavaScript and none is valid JSON.