Enter the required information
Use the fields in the tool above and keep units and formats consistent.
Check JSON against strict syntax rules and see the exact line where it fails. Catch trailing commas, single quotes, missing brackets and stray comments.
An "Unexpected token" message tells you something is wrong but rarely what. A JSON validator parses your text against the strict standard, RFC 8259. It points to the line and column where parsing fails. Most problems fall into a handful of patterns.
| Error | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment in file | {"a": 1 // id} | {"a": 1} |
| Wrong literal case | {"ok": True} | {"ok": true} |
| Undefined or NaN | {"x": NaN} | {"x": null} |
Most of these come from writing JSON by hand or copying JavaScript objects. Python users meet the True and None problem often. That is because printing a dictionary shows Python syntax, not JSON.
Parsers report where they gave up, not always where the mistake began. If the validator flags line 40, look at line 39 as well. A missing comma at the end of one line often surfaces as an unexpected string on the next.
Unclosed brackets are the trickiest case. The error may appear at the very end of the file with "Unexpected end of input". Count opening { and [ against their closing partners, or format the valid portion to see where the nesting drifts.
Some problems are invisible. A byte order mark, a non-breaking space or curly quotes from a word processor all look normal on screen. If the error points to a spot that seems fine, retype that character by hand. Saving files as UTF-8 without a BOM also prevents trouble.
{ or [. Partial copies from logs often miss the opening bracket.\" or \\.A syntax check only confirms the text is well-formed JSON. It will happily accept {"age": "twenty"} even if your API expects a number. Schema validation is a separate step. It checks types, required fields and allowed values against a JSON Schema document.
Use the ToolsMate JSON validator for the first job. It catches typos before they break a deploy, config file or webhook. For contract testing between services, add a schema validator such as Ajv to your build. Together, the two checks catch both broken syntax and wrong data.
A quick syntax check pays off in a few common places. Try it on package.json before an npm install and on a webhook body before a test call. JSON-LD schema deserves a check before every site release.
Use the fields in the tool above and keep units and formats consistent.
Review the result shown in the output area.
Confirm that the result matches your situation before using it for a decision.
The input is parsed as JSON; parsing success means valid JSON.This describes the core logic used by the tool. Check any assumptions that may affect your result.
Use accurate inputs and keep units consistent.
Review the assumptions before using the result for a decision.
Compare important results with an independent or official source.
No, standard JSON does not allow a comma after the last item in an object or array. JavaScript and some config formats such as JSON5 accept them. That is why this error appears so often when people copy code into JSON files.
Strict JSON has no comment syntax. Lines starting with double slashes, or blocks in slash-star form, cause a parse error. Formats like JSONC, used by VS Code settings, allow comments, but standard parsers will reject them.
Position 0 means the very first character is wrong. Common causes are an HTML error page returned instead of JSON, or a byte order mark at the file start. An empty response body from the server also triggers it.
Yes, every key must be a string wrapped in double quotes. Single quotes and bare words are valid in JavaScript object literals, but a JSON parser rejects them. String values follow the same double-quote rule.
Wrap JSON.parse in a try and catch block. If parsing succeeds, the text is valid and you get the object back. If it throws a SyntaxError, the message usually includes the position of the problem character.
Yes, null is one of the valid JSON literals alongside true and false, and it must be lowercase. JavaScript values like undefined, NaN and Infinity are not valid, so serialisers usually convert them to null or drop them.
In everyday use the terms mean the same thing: a check that the text follows JSON syntax. JSONLint is the name of a popular tool. Many people now use it as a general word for JSON validation.
Explore other useful tools across the site.