Format JSONL Files (JSON Lines)
JSONL, also known as JSON Lines or NDJSON, is a streaming-friendly format where each line of the file contains one complete JSON document, terminated by a newline.
Native JSON tool
JSON Formatter
Runs locally in your browser
No server upload during processing
No server-side file retention
No watermark added
- Cost
- Free tier
- Sign-up
- Not required
- Processing
- Tool-specific
- Privacy
- Clearly disclosed
Add this JSON Formatter to your website
Drop the JSON Formatter into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.
- One copy-ready line of HTML
- Responsive — adapts to any container width
- No API credentials are placed in the snippet
Embed code
<iframe
src="https://www.fixtools.io/json/json-formatter?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="JSON Formatter by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
Why JSONL Exists and When to Use It Instead of an Array
JSONL emerged from data engineering and log processing workflows where streaming the data is more efficient than loading it into memory. A 100 gigabyte file written as one giant JSON array of records cannot be parsed in a streaming fashion by a strict RFC 8259 parser because the parser must wait for the closing bracket of the array before producing any structured output. The same data written as JSONL, with one record per line, can be processed record by record with constant memory regardless of total file size. This streaming property is the entire reason JSONL exists as a distinct format from standard JSON, and it is why every large-scale data system from BigQuery to Snowflake to Spark accepts JSONL as a first-class input format.
The format is intentionally simple. Each line of a JSONL file is a complete JSON document, typically an object but sometimes an array or even a primitive value. Lines are separated by single newline characters (LF), and the file may or may not end with a trailing newline. Blank lines are ignored. There is no global schema, no wrapper, and no metadata at the file level. This simplicity is the source of the format streaming power: a JSONL file is a concatenation of independent JSON documents, so it can be split, merged, sorted by record, and processed in parallel with bog-standard line-oriented Unix tools such as head, tail, grep, awk, and split. None of these operations work cleanly on a single giant JSON array.
Common uses for JSONL include application log aggregation (every log line is one JSON record with timestamp, level, message, and metadata fields), machine learning training data (each training example is one JSONL record with features and labels), webhook event archives (each delivered event is one JSONL record with the full payload and delivery metadata), and analytical data warehouse staging (raw events land as JSONL files in object storage before transformation into columnar table formats). The common thread is that the records are independent and can be processed without reference to each other, which is exactly the property JSONL is designed to support.
When to use JSONL versus standard JSON depends on the consumer. Use JSONL when records are independent, the file may be large, the consumer streams records one at a time, or you need to combine with line-oriented Unix tools. Use standard JSON when the data has a meaningful global structure, the file is small enough to load fully into memory, or the consumer is a tool that does not understand JSONL. For interchange between systems that support both, JSONL is often the better default because it scales gracefully without sacrificing functionality on small datasets. Tools that produce standard JSON can convert to JSONL with jq -c .[] input.json > output.jsonl in one step.
JSONL also interacts well with compression. Gzip and brotli build dictionaries of repeated substrings, and JSONL files with similar records benefit from dictionary reuse across records. A 1 gigabyte JSONL log file may compress to 100 megabytes or less, with the same compression ratio that a single giant JSON array would achieve. The advantage of JSONL is that the compressed file can still be decompressed and streamed line by line without loading the full content, because gzip and brotli support streaming decompression. Combining JSONL with gzip is the standard format for large log archives, training datasets, and event stores in modern data infrastructure.
How to use this tool
Paste your JSONL file and choose Format Per Record (one pretty record per line) or Wrap as Array (single JSON document containing all records).
How It Works
Step-by-step guide to format jsonl files (json lines):
- 1
Paste your JSONL
Paste the JSONL or NDJSON content into the input area. The tool detects multiple JSON documents separated by newlines and processes each one independently. Lines that are blank or contain only whitespace are ignored, which matches the standard JSONL handling defined at jsonlines.org and used by tools such as jq and BigQuery.
- 2
Choose your output mode
Select Format Per Record to produce one pretty printed record per line of output, which is useful for log inspection and per-record review. Select Wrap as Array to produce a single JSON document containing all records as elements of a top-level array, which is useful when you need to pass the data to a tool that expects strict JSON rather than JSONL.
- 3
Click Format
Click the Format button. The tool parses each record independently and reports the line number of any record that fails to parse. The output appears in the panel on the right in the chosen mode. For JSONL files with thousands of records, expect a brief pause while each record is parsed and rendered, but the total time stays well under a second for typical log file sizes.
- 4
Copy or save
Use the copy button to copy the formatted output to your clipboard. For very large JSONL files, prefer the command-line equivalent jq . file.jsonl, which streams the input and writes the output without loading everything into the browser. The jq output is byte-identical to the FixTools per-record output for the same input.
Real-world examples
Common situations where this approach makes a real difference:
Log analyst
JSONL filtering with jq plus per-record formatting in a browser is the standard log analysis workflow for incident response.
ML engineer
Converting bulk JSON datasets to JSONL during preparation is standard practice for machine learning workflows that benefit from streaming data access.
Data engineer
JSONL is the standard ingestion format for cloud data warehouses because it parallelises efficiently across compute nodes.
API engineer
NDJSON streaming over HTTP enables real-time UI updates for long-running queries without latency or memory penalties.
Pro tips
Get better results with these expert suggestions:
Use jq -c for line-oriented output
The jq command-line tool with the -c flag produces compact single-line output, which is exactly the JSONL format. The command jq -c .[] input.json reads a top-level array and writes one record per line, converting from standard JSON to JSONL in one step. To go the other way, jq -s . input.jsonl reads a JSONL stream and wraps it in a top-level array. These two conversions cover most of the conversion needs between the two formats and are the standard pattern in data engineering pipelines.
Filter JSONL with grep before formatting
Because each JSONL record is on its own line, line-oriented tools like grep work directly on JSONL files. grep "error" app.log.jsonl extracts only the records containing the word "error" anywhere in the line. The result is still valid JSONL because each matched line is still a complete JSON document. Pipe through jq for proper field-aware filtering when grep is too coarse: jq -c "select(.level == \"error\")" app.log.jsonl filters by the level field specifically.
Use NDJSON content type for HTTP streaming
When streaming JSONL over HTTP, use the application/x-ndjson content type to tell clients to expect a line-oriented JSON stream rather than a single document. The Elastic Bulk API and several other streaming APIs use this content type, and modern HTTP clients including curl and the browser fetch API handle it natively when you process the response as a stream rather than a full body. This pattern enables real-time data delivery to browsers and CLI tools without the latency of waiting for a complete response.
Compress JSONL with gzip for storage
JSONL compresses extremely well with gzip because similar records share dictionary entries during compression. A typical application log JSONL file compresses to 10 to 20 percent of its uncompressed size with gzip --best. The compressed file can still be streamed line by line by piping through gunzip -c, so all the JSONL streaming benefits survive the compression. This combination is the standard format for long-term log archives, training data storage, and event store backups in modern data infrastructure.
Frequently asked questions
Related guides
More use-case guides for the same tool:
Related tools
Other tools you might find useful:
JSON Validator
Validate each JSONL record individually for syntax errors.
JSON Formatter
Format a single JSON document when working with one record at a time.
JSON to CSV
Convert a JSONL stream to CSV for spreadsheet analysis.
Minify JSON
Compact each JSONL record back to its original single-line form.
Ready to get started?
Open JSON Formatter to review its free limits and processing method.
Open JSON Formatter →Free tier · No account needed · Transparent limits