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 -landgrepwork 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
.jsonlfile 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
| Input | Output |
|---|---|
| Array of objects | One object per line |
Array of arrays, e.g. [[1,2],[3,4]] | One inner array per line |
| A single object | That object on one line (1 line written) |
| Text that is already JSON Lines | Each 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.