JSON Lines
JSON Lines (JSONL or NDJSON) is a text format where each line is one complete JSON value, usually an object, separated by newline characters. Streams are append-friendly for logs and bulk exports, and clients can parse incrementally without loading an entire array into memory.
Technical Architecture & Deep-Dive
Unlike a JSON array file, JSON Lines lets producers append rows while consumers read line by line with backpressure. Many ML datasets and observability tools standardize on JSONL for that reason.
APIs may offer application/x-ndjson responses for large downloads. Edge converters can transform JSON Lines streams into paginated JSON arrays for mobile clients that expect classic REST envelopes, or compress lines for bandwidth-sensitive sync jobs.
Key Architectural Benefits
Implement JSON Lines at the Edge
Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.
Frequently Asked Questions
Q:How is JSON Lines different from CSV export?
JSON Lines preserves nested objects per row. CSV flattens scalars into columns and struggles with deep nesting without custom rules.
Related Architecture Concepts
CSV API export delivers tabular data as comma-separated text, often via Accept headers or dedicated /export endpoints, so analysts open results in spreadsheets without writing JSON parsers. Edge layers flatten nested JSON, apply column allowlists, and stream large exports without holding entire datasets in mobile client memory.
Data serialization is the process of converting in-memory objects into a byte or text format for storage or transmission, and deserializing them back on the other side. APIs serialize responses as JSON, XML, protobuf, MessagePack, or other formats depending on client and performance needs.
JSON-LD embeds linked data in JSON using an @context document that maps keys to IRIs from shared vocabularies. Search engines and integrators consume JSON-LD for rich snippets, while APIs can reuse the same context to align field meanings across services without bespoke field dictionaries in every response.