JSON to JSON Lines

Split a JSON array into one record per line.

Reverse
Input
JSON input
Output
Result

About this tool


JSON Lines (also called NDJSON) stores one complete JSON value per line. The point is streaming: a consumer can process each line as it arrives rather than waiting for a closing bracket, and a single corrupt record does not invalidate the whole file.

It is the standard format for log shipping, BigQuery and Athena imports, Elasticsearch bulk loads, and machine-learning datasets, anywhere records are appended continuously or processed line by line.

How to use it

  1. Paste or upload JSONDrop a .json file onto the input pane, use the file picker, or paste the text directly.
  2. Adjust the options if neededThe defaults suit most input. Open Options to change how values are interpreted or formatted.
  3. ConvertPress Convert to JSON Lines, or use Ctrl+Enter (Cmd+Enter on macOS).
  4. Read any warningsWarnings explain anything that could not be represented exactly in the target format.
  5. Copy or downloadCopy the result, or download it as a .jsonl file.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

JSON to JSON Lines

Input

[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]

Output

{"id":1,"name":"Alice"}
{"id":2,"name":"Bob"}

The array brackets and separating comma are gone; each record stands alone on its line.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

The input must be an array
JSON Lines represents a sequence of records, so the source has to be a top-level array. Each element becomes one line. A single object is not an array and is rejected with an explanation rather than emitted as a one-line file that hides the mismatch.
Each line is minified
A record must occupy exactly one line, so every value is serialised compactly with no internal newlines. Any newline inside a string is escaped as \n, which keeps the line boundary meaningful. That is the whole property the format depends on.
Why appending is the real advantage
Adding a record to a JSON array means rewriting the closing bracket, so you cannot append safely to a live file. With JSON Lines you write a line and you are done, which is why log pipelines and event streams use it.
No enclosing brackets or commas
The output has no wrapping [ ] and no commas between records. Each line is independently parseable, so the file as a whole is not valid JSON. That is by design, and tools expecting JSON Lines rely on it.

Limitations


  • Requires a top-level array; a single object or scalar is rejected.
  • The output is deliberately not valid JSON as a whole document.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


What is the difference between JSONL and NDJSON?
In practice, nothing. Both mean one JSON value per line, and the extensions .jsonl and .ndjson are interchangeable. NDJSON has a formal specification requiring UTF-8 and \n line endings, which this output satisfies.
Why does my single object fail to convert?
The format represents a sequence, so the input must be an array. Wrap your object as [{...}] to produce a one-record file.
Can I open the result in a JSON parser?
Not as a whole, the file is intentionally not valid JSON. Parse it line by line, or use the JSON Lines to JSON converter to wrap it back into an array.