What counts as invalid JSON
JSON is strict, and most broken payloads fail for one of a handful of reasons. The validator names each of them precisely instead of printing a generic “unexpected token”:
- Trailing commas after the last item of an array or object.
- Single quotes around keys or strings, usually from a Python
print()or a hand-written JavaScript object. - Missing commas between two properties, often after a line was pasted in.
- Unquoted keys, comments (
//and/* */),undefined,NaNandInfinity, none of which exist in JSON. - Python literals such as
True,FalseandNone. - Bad strings: a raw line break inside quotes, or a backslash that does not start a valid escape (the classic Windows path
"C:\Users"). - Bad numbers: leading zeros (
007), a bare.5, or1.with nothing after the point. - Truncated input, where a bracket opened near the top is never closed.
- Extra content after the first complete value, such as two objects pasted back to back.
Where these errors come from
The message that sends you here is rarely helpful on its own. A few that map directly to the list above:
npm error code EJSONPARSEis a syntax error inpackage.json, usually a trailing comma after the last dependency or script.JSON.parse: expected ',' or '}' after property valueis Firefox’s wording for a missing comma.JSON.parse: unexpected character at line 1 column 1in Firefox usually means the input was not JSON at all, such as an HTML error page.- A config file that “works in my editor” but fails in production often contains comments: editors accept JSONC for files like
tsconfig.json, while a strict parser does not.
Validating the exact bytes your program received is more reliable than checking the file on disk, since a proxy or template step may have changed them. Log the raw string, then paste it here.
How problems are reported
Validation happens as you type. When the input breaks, the offending line is highlighted in the editor, the status bar shows the error count, and the message gives a 1-based line and column plus a hint such as “Add a ‘,’ between the two properties”. The output pane keeps the last valid result, dimmed, so you do not lose your place while fixing a typo. For the common mistakes listed above, the Fix it button repairs the input and shows a diff of every change before you accept it. Press Ctrl/Cmd+Enter to re-run validation on large files, where live checking switches to on-demand.
Some findings are warnings rather than errors. A duplicate key is valid syntax according to the spec, but most parsers silently keep only the last value, so the validator flags it with the position of the repeat. A UTF-8 byte-order mark at the start is removed with a note, because JSON.parse in many runtimes rejects it.
Numbers are checked without losing precision
The parser behind this page keeps numbers as the digits you wrote instead of converting them to JavaScript doubles. An ID such as 9007199254740993 is accepted and printed back unchanged, while JSON.parse would round it to 9007199254740992. That difference matters when you copy the output back into a request.
Syntax validation is not schema validation
A document can be perfectly valid JSON and still be wrong for your API: a missing email field, a price sent as a string, an unknown enum value. Syntax validation only answers “will a JSON parser accept this?”. To check structure and types, use the JSON Schema validator, which supports drafts 04 through 2020-12 and can also check OpenAPI 3.x and Swagger 2.0 documents. If you have no schema yet, the JSON to JSON Schema converter can draft one from a sample payload.
Everything runs locally in your browser tab, so a payload containing customer records or access tokens stays on your machine.
Examples
package.json that npm refuses to read
Invalid: the comma after the last script is what npm reports as EJSONPARSE. The validator gives its exact line and column, and Fix it removes it.
{
"name": "orders-service",
"version": "2.4.0",
"scripts": {
"build": "tsc -p .",
"test": "vitest run",
},
"dependencies": {
"fastify": "^5.1.0"
}
}Line 6, column 25: Trailing comma before '}'Python dict logged instead of JSON
Invalid: single-quoted keys are flagged first; True and None would be reported next as Python literals.
{'user': 'aisha', 'active': True, 'manager': None}Line 1, column 2: Object keys must use double quotes, not single quotesTwo log records pasted together
Invalid: each line is fine alone, but a JSON document holds one top-level value. Line 2 is reported as extra content, which points to the JSON Lines validator instead.
{"level":"error","msg":"payment declined","orderId":"ord_8f2k1"}
{"level":"info","msg":"retry scheduled","orderId":"ord_8f2k1"}Line 2, column 1: Unexpected content after the end of the JSON valueValid JSON with a duplicate key
The document parses, but the second “retries” triggers a warning because most parsers keep only the value 5.
{
"service": "checkout",
"retries": 3,
"timeoutMs": 3000,
"retries": 5
}{
"service": "checkout",
"retries": 3,
"timeoutMs": 3000,
"retries": 5
}
Common errors and how to fix them
| Error | Cause | Fix |
|---|---|---|
Trailing comma before ']'Explained | A comma follows the last element of an array; JavaScript allows this, JSON does not. | Delete the comma, or press Fix it. |
Missing comma after line 12Explained | Two properties or array items sit next to each other without a separator. | Add a comma at the end of the line named in the message. |
Unexpected '<' where a value was expectedExplained | You pasted an HTML page, typically an error page or login redirect returned instead of the API response. | Check the status code and Content-Type of the response; the real JSON never arrived. |
Invalid escape sequence '\U' in stringExplained | A single backslash is followed by a character JSON does not recognise, as in a Windows path. | Double the backslash (\) or use forward slashes. |
Unexpected content after the end of the JSON valueExplained | Several JSON values were pasted one after another, as in a log file. | Wrap them in an array, or validate the file as JSON Lines instead. |
Comments are not allowed in JSONExplained | The file uses // or /* */ comments, which editors accept in JSONC files such as tsconfig.json but a strict parser rejects. | Remove the comments before the file reaches a strict parser, or validate it as JSON5 if your consumer allows them. |
Frequently asked questions
Which JSON standard does the validator follow?
RFC 8259 / ECMA-404, the same grammar as JSON.parse. Comments, trailing commas and unquoted keys are rejected; use the JSON5 validator for files that allow them.
How do I fix npm EJSONPARSE in package.json?
Paste package.json here to find the exact line. It is almost always a trailing comma or a merge conflict marker left in the file.
Can it validate JSON against a schema?
Not on its own: this check is syntax only. The JSON Schema validator checks types, required fields and formats against a schema you provide.
Why is my JSON valid here but rejected by my application?
Usually the application expects a particular shape, or it rejects duplicate keys or a byte-order mark that the spec tolerates. Check the warnings shown below the editor, then validate against your schema.
Is there a size limit?
There is no fixed limit; the practical ceiling is your device memory. Above about 1 MB the tool stops validating on every keystroke and waits for Ctrl/Cmd+Enter so the tab stays responsive.
Is the JSON I paste sent anywhere?
No. Parsing and validation run in a Web Worker inside your browser, and the page makes no request with your input.