Why Is My JSON Invalid? Full Checklist

If you landed here without a specific error message, just knowing your JSON “isn’t working,” this post is a general checklist to help you rule out the most common causes one by one, without needing to decode a specific error message first.

If you already have the exact error message in hand, it’s worth jumping straight to the matching post (each common error has its own, linked at the end). But if you’re just trying to figure out where to start, here’s the checklist.

1. Are all keys wrapped in double quotes?

// json
// Invalid
{name: "test"}

// Valid
{"name": "test"}

JSON requires double quotes on every key, no exceptions. Unquoted keys or single-quoted keys are one of the most common mistakes for people coming from JavaScript.

2. Are all string values wrapped in double quotes (not single)?

// json
// Invalid
{"name": 'test'}

// Valid
{"name": "test"}

3. No trailing comma before } or ]?

// json
// Invalid
{"a": 1, "b": 2,}

// Valid
{"a": 1, "b": 2}

4. Does every { have a matching }, and every [ a matching ]?

Worth counting them visually, or using a validator, which is much easier than counting by hand, especially in large JSON files.

5. No comments inside the JSON?

// json
// Invalid
{
  "name": "test" // this breaks the JSON
}

JSON doesn’t support comments, even if the tool you use daily (like an editor with JSON5, or a tsconfig.json) allows them.

6. No values that only exist in JavaScript, like undefined, NaN, or Date?

// json
// Invalid
{"value": undefined}

// Valid
{"value": null}

7. Is the string not empty, and not cut off midway?

If the JSON comes from an API, check that the response arrived complete and wasn’t truncated by a timeout or a size limit.

8. No more than one object or array pasted together without a separator?

// json
// Invalid
{"a": 1}{"b": 2}

// Valid (if the intent is to have both)
[{"a": 1}, {"b": 2}]

9. Are the numbers in the right format?

// json
// Invalid
{"value": 01}     // leading zero isn't allowed
{"value": .5}     // missing the 0 before the decimal point
{"value": 5.}     // missing the digit after the decimal point

// Valid
{"value": 1}
{"value": 0.5}
{"value": 5.0}

Less common, but worth checking if the JSON was generated by a system that formats numbers in a non-standard way.

10. Are special characters inside strings escaped correctly?

// json
// Invalid
{"message": "he said "hi""}

// Valid
{"message": "he said \"hi\""}

Double quotes inside a string need to be escaped with \". The same goes for backslashes (\\) and line breaks (\n).

The fastest way to find the problem

Instead of manually checking each item, paste the JSON into <a href=”/”>JSONFast’s validator</a>. It points to the exact position of the error, which saves a lot of time compared to ruling out causes one at a time.

Specific posts by error type

If you’ve already identified the exact error message, these posts go into more detail: