These are separate operations and it is worth knowing which one failed:
| Written | Problem |
|---|---|
{'key': 'value'} | JSON requires double quotes — single quotes are a JavaScript habit |
{"a": 1,} | Trailing comma — allowed in JS, forbidden in JSON |
// comment | JSON has no comment syntax at all |
{a: 1} | Unquoted keys are invalid |
{"n": 01} | Leading zeros are not permitted on numbers |
{"n": NaN} | Not a number; JSON has no NaN or Infinity |
The single most common cause of a "broken" API payload is a trailing comma left behind after deleting the last item.
JSON5 and JSONC relax the rules to allow comments, trailing commas and single quotes — useful for configuration files, but they are not valid JSON and will be rejected by any strict parser. YAML is a superset that is easier to write by hand but full of its own ambiguities: the "Norway problem", where the country code NO is read as the boolean false, is the classic example. NDJSON puts one complete JSON object per line, which makes huge datasets streamable.
Valid JSON can still be the wrong shape. JSON Schema describes what a document is supposed to contain — required fields, types, ranges — so a payload can be checked against a contract rather than merely parsed. For anything exchanged between systems, a schema is what stops a field silently changing type.
$.store.book[0].title to extract the node you need from the result.