How to use the JSON Validator
- Paste your JSON into the left box, or drop a .json file onto it.
- Read the result in the status bar: Valid JSON, or the error with its line and column. The cursor jumps to the problem.
- Click Fix it to repair trailing commas, single quotes, unquoted keys, comments and missing brackets. Undo brings your original back.
- Copy the valid, formatted JSON from the right.
What makes JSON invalid?
JSON is stricter than the JavaScript it came from. These are the mistakes the validator finds most often. If you have an error message from your code, such as “Unexpected end of JSON input”, see JSON errors explained; to fix a whole file at once, use JSON Repair.
| Invalid | Valid | Why |
|---|---|---|
{"a": 1,} | {"a": 1} | No trailing commas |
{'a': 'x'} | {"a": "x"} | Double quotes only |
{a: 1} | {"a": 1} | Keys must be quoted |
{"a": 1} // note | {"a": 1} | No comments |
{"ok": True} | {"ok": true} | Lowercase true, false, null |
{"n": 012} | {"n": 12} | No leading zeros |
{"n": NaN} | {"n": null} | No NaN or Infinity |
Reading the error message
The error points at the place where the parser gave up, which is usually just after the real mistake. If it says unexpected token at the start of a line, look at the end of the line before: a missing comma is the most common cause.
Valid JSON, wrong data?
A validator checks the syntax, not the meaning. To check that the data has the fields you expect, compare it with a known-good file in JSON Compare, or explore it in the JSON Viewer.
Frequently asked questions
Is my JSON sent to a server?
No. It's checked by your browser's built-in JSON parser, on your device.
Does it follow the JSON standard exactly?
Yes. It uses the same strict parser as JSON.parse, which follows RFC 8259. Anything it accepts will load in any language.
Can it validate against a JSON Schema?
Not yet. It checks that the JSON is well formed.
Can it fix my JSON automatically?
Yes, for common mistakes. Click Fix it when an error appears, and it tells you what it changed.
Updated