Cluster C1: JSON Ecosystem
JSON vs JSON5 differences
JSON5 improves authoring ergonomics with comments, trailing commas, and unquoted keys, but many production parsers still expect strict JSON. Teams that do not separate authoring format and transport format often hit avoidable runtime failures.
Syntax differences that matter in production
- JSON requires double-quoted keys and strings; JSON5 allows unquoted keys and single quotes.
- JSON disallows trailing commas; JSON5 allows them in objects and arrays.
- JSON has no comments; JSON5 supports inline and block comments.
- Many API gateways and validation libraries only accept strict JSON payloads.
Migration rule of thumb
Use JSON5 only as an authoring layer in developer-facing config files. Before anything crosses network boundaries, compile or normalize to strict JSON and validate with your target parser version. This keeps developer convenience while preserving transport compatibility and predictable schema checks.
Practical input/output example
Input (JSON5)
{
apiHost: 'https://api.example.com',
retry: 3,
}Output (JSON)
{
"apiHost": "https://api.example.com",
"retry": 3
}