Quick answer: to validate JSON, paste it into a validator such as the JSON Formatter. If the syntax is wrong it points to the line and column where parsing failed. That position is where the parser noticed the problem, so the real mistake is often on the same line or just before it.

What "valid JSON" means

JSON is stricter than JavaScript object syntax, even though it looks the same. A document is valid when it follows the grammar in the JSON standard (RFC 8259): one value at the top level, double-quoted strings, no comments, no trailing commas. Validation checks syntax only. It cannot tell you whether the data makes sense for your application. That needs a schema, covered at the end.

The most common errors

1. A trailing comma

The last item in an object or array must not be followed by a comma.

{ "name": "Ada", "age": 36, }      ✗
{ "name": "Ada", "age": 36 }       ✓

2. Single quotes

Strings and keys must use double quotes. Single quotes are valid in JavaScript but not in JSON.

{ 'name': 'Ada' }       ✗
{ "name": "Ada" }       ✓

3. Unquoted keys

Every key is a string, so it needs quotes: { "name": "Ada" }, not { name: "Ada" }.

4. Comments

JSON has no comment syntax. Remove // like this and /* like this */. If you need notes, add a dedicated key such as "_note", or keep the explanation in separate documentation.

5. Missing commas or mismatched brackets

Forgetting the comma between two items, or closing a { with a ], are the classic copy-and-paste mistakes. Pretty-printing the document makes the nesting visible, so an extra or missing bracket tends to stand out.

6. Unescaped characters inside strings

A raw line break inside a string is not allowed; write \n instead. A literal double quote must be written \", and a backslash must be doubled. This catches many Windows file paths:

{ "path": "C:\Users\ada" }     ✗  (\U is not a valid escape)
{ "path": "C:\\Users\\ada" }   ✓

7. Values JSON does not have

undefined, NaN and Infinity are not valid JSON values. Use null for "no value", or leave the key out.

8. Numbers in the wrong format

Leading zeros (007), a leading plus sign (+5), a bare decimal point (.5) and hexadecimal (0xFF) are all invalid. Write 7, 5 and 0.5, and convert hex to decimal.

9. Hidden or "smart" characters

Text copied from a word processor or web page can contain curly quotes (“ ”) that look like straight quotes but are different characters. A byte order mark at the very start of a file can also upset some parsers. If the error position points at something that looks perfectly fine, retype the quotes by hand.

10. More than one top-level value

A single JSON document has one root value. Two objects side by side, or a log file with one object per line, is not valid as a whole. Wrap the items in an array, or validate each line separately.

A quick workflow

  1. Paste the JSON into the validator and run it.
  2. Go to the reported line and column, then check that spot and the line above it.
  3. Fix one error at a time. Parsers usually stop at the first problem, so another error may appear once you fix it.
  4. When it validates, pretty-print it to review the structure, or minify it for transmission.

Valid is not the same as correct

JSON can be perfectly valid and still be wrong for your use: a missing required field, a string where a number belongs. Checking that is called schema validation, and it uses a separate description of the expected shape, such as JSON Schema. Syntax validation is always the first step, because a schema check can only run on a document that parses.

New to the format? Start with What Is JSON?, or see how it compares with another format in JSON vs XML.