How to use the JSONL converter
- Paste your data into JSON array or JSON Lines.
- Leave Convert on Detect automatically, or choose JSON array → JSONL or JSONL → JSON array.
- When producing an array, choose an Indent. JSON Lines output is always compact, one record per line.
- Copy or download the result. The count shows Lines written or Records read.
What it does and when to use it
JSON Lines is the format of choice when records are added one at a time or read as a stream: application logs, BigQuery exports, Elasticsearch bulk uploads, and training or evaluation files for machine-learning tools, which often ask for a .jsonl file with one example per line. Many tools that produce or expect these files are not the ones you use to edit data, so you often need to switch between the two shapes.
Turn a hand-written or exported array into a JSONL upload file, or turn a log excerpt into an array so you can query, sort or view it. After converting to an array, filter it with JSON query, view it with JSON to table, or check one record with the JSON validator.
How it works
Array to lines: the input is parsed, each item is written with JSON.stringify and no spaces, and the lines are joined with \n plus a final newline. Any string that contains a line break keeps it escaped as \n, so no record ever spans two lines. This matches the JSON Lines rules: UTF-8, one valid JSON value per line, newline as separator.
Lines to array: the text is split on line breaks, empty lines are skipped, and each line is parsed on its own. The first line that fails stops the conversion, and the message gives its line and column with the surrounding lines shown. All of it runs in your browser.
Worked examples
A two-item training file:
[
{"prompt": "Capital of Kenya?", "completion": "Nairobi"},
{"prompt": "2 + 2", "completion": "4"}
]
{"prompt":"Capital of Kenya?","completion":"Nairobi"}
{"prompt":"2 + 2","completion":"4"}
Two log lines with a blank line between them, converted with Indent set to none, give one array and Records: 2.
A missing brace on line 2 gives:
Invalid JSON Lines — line 2, column 1: Unexpected end of input — a closing } is missing.
Limits and tips
- Array to JSONL needs a top-level array. A single object returns a message; wrap it in
[ ]. - Only the first bad line is reported. Fix it and run again to find the next one.
Frequently asked questions
Are JSONL, JSON Lines and NDJSON the same thing?
How does Detect automatically decide the direction?
What happens to blank lines?
Can a record span several lines?
Is there a size limit?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.