JSON Validator Online

Paste JSON and find out whether it parses. If it does not, you get the line and column where the parser gave up, and the text around it.

Input
Result

Paste something on the left. It is processed on this page and never uploaded.

What makes JSON invalid

Four causes account for almost every failure. A trailing comma after the last element, which JavaScript allows and JSON does not. Single quotes instead of double quotes. Unquoted keys, which are legal in a JavaScript object literal but not in JSON. And comments, which JSON has no syntax for at all.

The other common one is an unescaped control character inside a string, usually a real newline that arrived when a value was pasted from somewhere else.

Valid is not the same as correct

This checks syntax, which is whether a parser will accept the document. It does not check that the document has the fields your application expects or that the values are sensible. That is what a JSON Schema validator is for, and it is a different tool.

Questions

Why does my JSON fail when it works in JavaScript?

JavaScript object literals allow trailing commas, single quotes, unquoted keys and comments. JSON allows none of those. The specification is deliberately smaller than the syntax it was named after.

Are comments allowed in JSON?

No. ECMA-404 defines no comment syntax. Some parsers accept them as an extension, which is why a file can work in one tool and fail in another. If you need comments, use JSON5, JSONC or YAML.

Other tools