JSON to JSONL (JSON Lines)
Write every record of a JSON array on its own line, or collect JSONL lines into one JSON array
Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.
Did this tool do the job?
Thanks, your feedback came through.
How it works
JSONL (JSON Lines) is a text format with one complete JSON record per line; fine-tuning datasets for AI models, BigQuery and Elasticsearch bulk loads and log files all expect it. If your data is a JSON array inside [ ... ], paste it into the left pane; with Direction set to "JSON array → JSONL", every record is written on a single line. The three prompt/completion records in the sample become a three-line JSONL file that ends with a newline, as JSONL tools expect. Records are not re-serialized: they are cut from the source text and only insignificant whitespace is removed, so large IDs such as 9007199254740993 that JavaScript would round, and spellings such as 1.0, stay exactly as they were. For the reverse, paste JSONL lines and set Direction to "JSONL → JSON array": each line is read on its own and all of them are collected into one JSON array; blank lines are skipped and a broken line is reported by number (for example "Line 3 is not valid JSON").
This tool is also known as json to jsonl, jsonl to json, json lines converter, convert json array to jsonl, ndjson converter.
What is JSONL (JSON Lines)?
JSONL is a plain-text format in which every line is a valid JSON value on its own; lines are separated by \n and the file is UTF-8. Because the file as a whole is not one JSON document, a program can process one record before reading the next, and new records can be appended without rewriting the file. That makes it the standard for logs, data streams and AI training sets.
What is JSON array?
A JSON array is a list of values in square brackets separated by commas: [{"id": 1}, {"id": 2}]. It is what most APIs return and what you hand to a spreadsheet or a program in one go. It is only valid once the closing bracket has been read, so very large arrays are loaded into memory in full; JSONL avoids that limit by putting each record on its own line.
What is the difference between JSON and JSONL?
JSON is a single value: all records sit inside one array, and the file is valid only after the final bracket is read. JSONL keeps records as separate JSON values, one under the other; each line can be read on its own, appending to the end is trivial and millions of lines can be processed in chunks. JSON suits human reading and API responses, JSONL suits bulk loading, logs and model training data. Either can be converted into the other without loss.
Pitfall: a record must not span several lines
In JSONL the line break is the separator between records, so a record cannot contain a real line break: a newline inside a text field must be written as the \n escape. Saving pretty-printed (indented) JSON as JSONL is the most common mistake; the reader sees only { on the first line and stops. In the JSON → JSONL direction this tool strips whitespace and line breaks inside a record while leaving strings untouched; in the other direction it points to a split record by line number.
JavaScript's JSON.parse and JSON.stringify round integers above 2^53 (9007199254740993 becomes 9007199254740992) and write 1.0 as 1. For database IDs that is silent data loss. Because this tool cuts records out of the source text, numbers, key order and Unicode escapes do not change.
Which direction to use when
JSON array → JSONL: when you prepare a fine-tuning file for OpenAI or a similar model, load NEWLINE_DELIMITED_JSON into BigQuery, send an Elasticsearch _bulk request or produce a log that will be processed line by line. JSONL can be read one line at a time without loading the whole file into memory, which is why large datasets use it.
JSONL → JSON array: when you want to open an API export or a log as a single JSON document, or feed it to a table or a JSON to CSV converter. If the root is an object (for example {"records": [...]}), the tool produces a one-line JSONL; paste the inner array to split the records.
Frequently asked questions
How do I convert a JSON file to JSONL?
Paste the JSON array into the left pane on this page and leave Direction at "JSON array → JSONL". Every record of the array becomes one line on the right. Download the result with the .jsonl extension and use it for model training, BigQuery or Elasticsearch.
Are JSONL and NDJSON the same thing?
In practice, yes. Both require one JSON value per line with \n between lines; the name JSON Lines comes from jsonlines.org and NDJSON (newline-delimited JSON) from a separate spec. The extension can be .jsonl or .ndjson; this tool's output fits both.
What does "Line 3 is not valid JSON" mean?
In JSONL every line must be a complete JSON value on its own. The error usually means a record was split over several lines (indented JSON), a trailing comma was left at the end of a line, or a quote was never closed. Check the line and column given in the message.
Is my data sent to a server?
No. The conversion runs entirely in your browser, so customer records or training data never leave this page. Once loaded, the page also works offline.