jsonecho

JSON Validator

Find out if your JSON is valid, and if it is not, exactly where it breaks.

Loading the tool...

How to use JSON Validator

  1. Paste the JSON or drop a file into the left box.
  2. Press Validate, or just wait a moment, validation runs as you type.
  3. A green bar means the document is valid and shows how many values it contains. A red bar shows the problem and the line.

About JSON Validator

A validator answers one question: will a strict JSON parser accept this text? That is the same test your server, your database or your app will apply, so it is better to find out here than in production.

We use a strict parser written for this site, not the one built into the browser, because browsers tend to give vague messages like "Unexpected token } in JSON at position 41". Ours tells you the line, the column and what it expected instead.

Mistakes people make most often

Almost every invalid document comes down to a short list: a comma after the last element, single quotes, comments, keys without quotes, a missing comma between two items, or an unescaped line break inside a string. All of them are flagged with a specific message here.

If your data comes from a JavaScript object literal or a config file that allows comments, try the JSON5 validator instead. JSON5 is a relaxed cousin of JSON that accepts those things.

Frequently asked questions

What counts as valid JSON?

The format defined in RFC 8259 and ECMA-404. Keys and strings in double quotes, no trailing commas, no comments, and values limited to objects, arrays, strings, numbers, true, false and null.

Does an empty object or a single number count as valid?

Yes. Since RFC 7159 any JSON value is allowed at the top level, so {}, [], 42 and "hello" are all valid documents. Older parsers only accepted objects and arrays.

Does the validator check against a JSON Schema?

No. This tool checks syntax only. It tells you that the text is well formed, not that the fields have the names or types your application expects.

Why do duplicate keys not cause an error?

The JSON standard does not forbid them, it only says behavior is undefined. Most parsers keep the last value. If you suspect duplicates, run the document through the formatter and look for the key twice.

Can I validate a file from a URL?

Yes, use From URL above the input box. If the site does not allow cross-origin requests we fetch the file through our server for you, with limits to prevent abuse.

More in JSON Tools

All tools →