FormatterHQ

JSON to JSONL Converter

Turn a JSON array into JSON Lines, also called NDJSON: one compact JSON record per line, ready for bulk loads, machine learning datasets and log pipelines.

Input JSON
Output TEXT
Ready.

How to use the JSON to JSONL Converter

  1. Paste a JSON array (or upload a .json file), or click Sample.
  2. Click JSON → JSONL. Each array element becomes one line, and the status bar shows how many lines were written.
  3. Use JSONL → JSON to turn JSON Lines back into an array if you need to go the other way.
  4. Copy the result or download it and save it with a .jsonl extension.

Convert JSON to JSONL

A JSON to JSONL conversion takes one big JSON array and writes each element as a separate, compact line. The result is JSON Lines, also known as newline-delimited JSON or NDJSON: a text file where every line is a complete JSON value and the newline is the only separator. There are no enclosing brackets and no commas between records.

Example

[
  {"id": 1, "user": "ava", "tags": ["pro"]},
  {"id": 2, "user": "noah", "tags": []},
  {"id": 3, "user": "mia", "note": "line1\nline2"}
]

Output, with "3 lines written" in the status bar:

{"id":1,"user":"ava","tags":["pro"]}
{"id":2,"user":"noah","tags":[]}
{"id":3,"user":"mia","note":"line1\nline2"}

The third record shows why the format works: a line break inside a value is written as the escape \n, never as a real newline, so every record always stays on its own line.

Why JSON Lines?

A JSON array must be read completely before it can be parsed, because the closing bracket comes at the very end. JSON Lines can be processed one record at a time. That brings several practical benefits:

  • Streaming. A reader can handle a multi-gigabyte file with constant memory, one line at a time.
  • Appending. Adding a record means appending a line; there is no closing bracket to rewrite.
  • Splitting and sampling. Line-based tools such as head, split, wc -l and grep work directly on records.
  • Error isolation. One broken line does not make the rest of the file unreadable.
  • Parallel work. A large file can be cut into chunks at any line break and each chunk processed separately, because no record depends on brackets opened earlier in the file.

Where JSONL is expected

  • Data warehouse loads. BigQuery, for example, imports newline-delimited JSON rather than a top-level JSON array.
  • Machine learning datasets. Fine-tuning and batch APIs for language models commonly take a .jsonl file with one training example or request per line.
  • Logs. Structured loggers and log shippers write and read one JSON event per line.
  • Exports and backups. Many databases and command-line tools export collections as JSON Lines.

How different inputs are handled

InputOutput
Array of objectsOne object per line
Array of arrays, e.g. [[1,2],[3,4]]One inner array per line
A single objectThat object on one line (1 line written)
Text that is already JSON LinesEach line re-parsed and written compactly
An empty array []Nothing (0 lines written)

Only the top-level array is split. Arrays nested inside records, such as tags above, stay inside their line. If the input is neither valid JSON nor valid JSON Lines, you get the parse error with its line and column. Fix the source, or try the JSON fixer first.

Tips

Save the output with a .jsonl or .ndjson extension so other tools recognize it. To read a JSONL file as a normal array again, use JSONL to JSON. If you only need one document squeezed onto one line, JSON to One Line is the simpler tool, and for tabular output consider JSON to CSV.

The conversion runs in your browser, so large exports are not uploaded. Load URL and Save & Share are the only features that go through our server.

Frequently asked questions

What is the difference between JSONL and NDJSON?
They describe the same format: one JSON value per line, separated by newline characters. JSON Lines is the name used with the .jsonl extension, NDJSON the name used with .ndjson and the application/x-ndjson media type.
Is a JSONL file valid JSON?
Not as a whole, unless it has exactly one line. Each line is valid JSON on its own, but several values in a row without brackets and commas are not a single JSON document.
Can a JSONL record span multiple lines?
No. Each record must be on one line, which is why the converter writes records compactly. Line breaks inside string values are stored as \n escapes.
What happens if my JSON is an object, not an array?
The object is written as a single line and the status bar says 1 line written. If the records are inside a property such as "items", copy that array on its own and convert it.
Does the conversion change my values?
No. Only whitespace is removed. Keys, values and record order stay the same, except that very large integers are rounded by the JavaScript parser.

Last updated October 3, 2026

Related tools

JSONL to JSON Converter Convert JSON Lines (JSONL / NDJSON) into a formatted JSON array. Invalid lines are reported with their line number. JSON to One Line Convert multi-line JSON to a single line. Collapse formatted JSON for logs, CLI arguments, environment variables and CSV cells. JSON to PHP Array Converter Convert JSON to a PHP array literal with short [] or array() syntax, ready to paste into Laravel config files, seeders and tests. JSON to String Converter Convert JSON to a single escaped string you can paste into code, databases or other JSON documents. Choose double, single or no quotes. JSON Tree Viewer Display JSON as an expandable tree. Collapse and expand objects and arrays to understand deeply nested data structures. JSON Unflatten Rebuild nested JSON from flat dot-notation keys (a.b.c) or bracket paths (a[0].b), the reverse of JSON flatten. JSON Validator Validate JSON online and find syntax errors fast. Get the exact line and column of each problem and fix broken JSON in one click. JSON Viewer & Beautifier View JSON as a collapsible tree and beautify it at the same time. Explore nested objects and arrays without losing your place. JSON5 Formatter Format and beautify JSON5 with comments, unquoted keys and trailing commas, or convert JSON5 to strict JSON. JSON5 Validator Validate JSON5 syntax online. Check config files with comments and trailing commas and get line and column for each error. JSONPath Tester Test JSONPath expressions online against your JSON. Supports filters, wildcards, recursive descent and slices, returning values or paths. String to JSON Converter Convert an escaped JSON string back into formatted JSON. Handles quoted literals, backslash-escaped text and double-encoded JSON.