Free · Fast · Privacy-first

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 in your browser
Formatted JSON
Run the tool to see a task-specific result.
⚡

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
IframeResponsiveAttribution included

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. 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. 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. 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. 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:

1

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.

2

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.

3

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.

4

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.

FAQ

Frequently asked questions

JSONL, also called JSON Lines or NDJSON, is a format where each line of the file is a complete JSON document, typically an object. Records are separated by single newline characters. It is the streaming-friendly cousin of standard JSON: a strict RFC 8259 JSON file is a single document, while a JSONL file is a sequence of independent documents that can be processed one at a time. The format is documented at jsonlines.org and is widely used in data engineering, log aggregation, and machine learning workflows because it streams efficiently regardless of file size.
A standard JSON formatter expects a single document as input and rejects multi-line JSONL files with a parse error after the first record. The FixTools JSONL formatter handles multiple records natively, parsing each line as an independent JSON document. To use a standard formatter with JSONL data, either format each line separately by hand or wrap the records into a top-level array first with jq -s . input.jsonl, which converts the JSONL stream into a strict JSON array that any JSON tool can read.
If your input is a single JSON document containing a top-level array of records, use jq -c .[] input.json > output.jsonl. This reads the array, emits each element as a single-line JSON document, and writes one record per line. The compact -c flag is essential because it produces single-line output rather than the default pretty printed multi-line format. The resulting file streams cleanly through any JSONL-aware tool and parses line by line with constant memory regardless of total size.
Use jq -s . input.jsonl > output.json. The -s or --slurp flag reads all input records into a single array and emits the array as a strict JSON document. The output is a top-level array containing each input record as an element, which is the standard wrapped form that strict JSON parsers expect. Note that this approach loads the entire content into memory, so for very large JSONL files (tens of gigabytes) this conversion may not fit in available RAM and a different approach is needed.
For JSONL files up to a few hundred megabytes, FixTools formats each record in the browser without issue. For files in the multiple gigabytes range, the recommended approach is jq at the command line, which streams the input line by line with constant memory. The command jq . input.jsonl produces per-record pretty printed output identical to what FixTools would produce in the browser for smaller inputs, so the same approach scales seamlessly from kilobyte to terabyte JSONL inputs without changing your formatting style or downstream consumption pattern.
There is no meaningful difference. JSONL (JSON Lines) and NDJSON (Newline-Delimited JSON) are two names for the same format: each line is a complete JSON document terminated by a newline character. The names emerged independently in different communities (JSONL from data engineering, NDJSON from web development) and are now used interchangeably. Both terms refer to the same file structure and the same parsing approach. Tools that advertise JSONL support also handle NDJSON input and vice versa, with no compatibility gap.
Yes, with the application/x-ndjson content type. This signals to clients that the response body is a line-oriented stream of JSON records rather than a single document. The Elastic Bulk API uses this content type for batch ingestion, and several streaming APIs use it for progressive result delivery. Modern HTTP clients including curl and the browser fetch API handle the content type natively when you process the response as a ReadableStream rather than awaiting a full response body. This pattern enables low-latency streaming workflows without the memory cost of buffering an entire result set.

Related guides

More use-case guides for the same tool:

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

Source-backed reference

JSON standards quick reference

Concise, standards-backed facts for developers working with JSON debugging and validation. Each claim is linked to the evidence registry and resolves to a primary standard or platform reference so it can be independently verified.

JSON standard
JSON is a text format for serializing structured data, with syntax defined by interoperable standards rather than by FixTools.
Strings and object keys
JSON strings and object member names use double quotation marks. Single-quoted strings are not valid standard JSON syntax.
Trailing commas
Standard JSON grammar does not allow a comma after the final member of an object or the final element of an array.
Parser behavior
JSON.parse() parses JSON text into a JavaScript value and raises a SyntaxError when the input is not valid JSON.

Common invalid → valid JSON examples

Trailing comma

{"a":1,}{"a":1}

Single-quoted key

{'a':1}{"a":1}

Unsupported literal

{"score":NaN}{"score":null}

Built for verification, not just extraction

Direct answers are paired with source-specific evidence. This keeps technical claims independently verifiable and gives search and answer systems a clearer provenance trail than unsupported summary copy.