JSON5 and JSONC: JSON with Comments
Both dialects exist because human-written config needs comments and trailing commas, but their syntax and ecosystem reach differ, so picking wrong jams your toolchain.
JSON5, JSONC, JSON Lines and NDJSON solve real needs such as comments, trailing commas and streaming, and bring compatibility and selection problems of their own.
6 articlesBoth dialects exist because human-written config needs comments and trailing commas, but their syntax and ecosystem reach differ, so picking wrong jams your toolchain.
One JSON value per line buys you appendability, streaming, and damage isolated to a single line; the cost is the absence of overall structure, so validation has to happen line by line.
RFC 7464 uses a 0x1E separator to stream JSON texts you can read and write at once. Covers the rules, how it differs from NDJSON, and a split-then-parse implementation.
Config files need comments, dates and multi-line text, which is where JSON falls short. Compare JSON, TOML, YAML and CSON, and see what conversion always loses.
MessagePack, CBOR and BSON all compress JSON into bytes. Compare byte cost, int64 and binary handling, and get a clear line for when switching is worth it.
Feeding a whole .jsonl file to JSON.parse and getting an error almost never means the file is broken — it means the wrong reading strategy. This guide covers the standard ways to inspect and read JSONL line by line, the commands for converting to and from JSON arrays, a six-row table of common bad lines, and the correct way to consume JSONL from streaming HTTP responses.