What's allowed in JSON
- Strings must use double quotes (
"like this"), never single. - Object keys are always strings, even if they look numeric.
- No trailing commas.
[1,2,3,]is invalid. - No comments. Use a JSON5 parser if you need them.
NaN,Infinity,undefinedaren't valid JSON values.
FAQ
Does my JSON leave the page?
No. All formatting and validation runs in your browser via the native JSON.parse / JSON.stringify functions.
Why does the error message say a different position than I expected?
The native parser reports the position where it gave up — usually one or two characters past the actual problem (e.g. a missing comma is detected at the next token).