JSON Toolkit

Extended Formats and Dialects

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.

10 articles

Articles in this category

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.

Beginner~10 min readUpdated 2026-10-30

JSON Lines and NDJSON: Streaming Data

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.

Intermediate~10 min readUpdated 2026-10-30

Working with JSONL Files: Open, Convert, and Debug Bad Lines

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.

Intermediate~9 min readUpdated 2026-11-06

JSON Repair Guide: Salvaging Broken LLM Output Without Losing Trust

LLM responses wrapped in markdown fences, trailing commas, and Python literals will not survive a strict parser — neither will hand-edited configs missing quotes. This guide draws the real line between nine error classes a repairer fixes and four it cannot, explains why state machines beat regex, and gives you a production-ready parse chain with jsonrepair and json-repair.

Intermediate~6 min readUpdated 2026-11-08

TOON Format Guide: Shrink JSON Before Feeding It to an LLM

Feeding a uniform array to a large language model in JSON burns tokens on repeated key names and brackets. TOON declares the structure once with indented objects and tabular arrays, then streams row data — official benchmarks show ~40% fewer tokens and higher parse accuracy. This guide covers the syntax, when the savings apply, when not to convert, and how to wire up encode and decode.

Beginner~6 min readUpdated 2026-11-10

When an LLM JSON Output Is Truncated: Read the Stop Reason First

The model returns JSON that stops mid-value, and the parser only gives you a column number. Closing the brackets makes it parse again, but every missing field is now hidden inside the data. This article draws the line between what truncation repair can honestly recover and what must be retried, from stop_reason gating to schema field ordering.

Advanced~5 min readUpdated 2026-11-14

Parsing JSON Before It Finishes Arriving: Streaming Preview and Incremental Repair

LLMs emit JSON token by token and APIs deliver big responses in chunks, but JSON.parse refuses to run until the whole document arrives. This guide separates three implementation styles — full repair, true incremental repair and partial parsing — and shows how an Allow mask keeps previews stable, backed by measured pipeline numbers and production-ready code.

Intermediate~5 min readUpdated 2026-11-16