Developer & Text Guides

Common JSON Syntax Errors and Safe Formatting

JSON requires double quotes, correct commas and matching brackets. A formatter should show an error location, but secrets should never be pasted into an untrusted site.

What to know before you start

JSON does not allow comments, single-quoted strings or trailing commas. Extremely large payloads can make the browser editor slow.

Recommended workflow

  1. Paste a representative JSON sample and validate it before changing formatting.
  2. Fix the first syntax error deliberately—common causes are trailing commas, comments, single quotes and missing delimiters.
  3. Format or minify only after validation passes, then test the payload in the system that will consume it.

How to check the result

Recheck the result against the original input and the rule you intended to apply. JSON does not allow comments, single-quoted strings or trailing commas. Extremely large payloads can make the browser editor slow.

Worked example and limits

Format {"id":9007199254740993,"active":true} and compare every ID digit with the input. The value true must remain a boolean. Then try {"a":1,}: this must report invalid JSON rather than guess a repair. Formatting whitespace does not verify the meaning of a field or whether an API accepts it.

Frequently asked questions

Can a formatter repair invalid JSON automatically?

A formatter can identify syntax errors, but silently guessing repairs can change data. Fix the reported issue deliberately.

Why is my JavaScript object not valid JSON?

JavaScript object literals can use syntax that JSON forbids, such as comments, undefined values or single-quoted strings.

JSON Formatter & Validator

Format, minify and validate JSON, locate syntax errors, copy or download the result, with input processed locally in the browser.

Open the related tool