Each item of a JSON array becomes one line of JSONL
A JSON array is a single JSON document: values separated by commas inside square brackets [ ]. JSONL (JSON Lines) writes one JSON value per line and separates the values with line breaks. Both formats can hold the same list, but they are read differently. You have to read an array up to its closing bracket before the document is complete, whereas JSONL can be read one line at a time and you can append a new record by adding one line at the end. The example array above holds four orders, so converting it gives four lines of JSONL.
This converter looks at what you pasted, decides whether it is an array or JSONL, and sets the direction for you. If the input is a pretty-printed (multi-line) API response wrapped in an object, such as {"data": [ … ]}, it finds the array inside and converts that. A minified one-line response is read as one JSONL line, so switch the direction to 'JSON array → JSONL' for it. The result panel lists the lines, each with a number, a shape letter and a size bar, and you can press a line to expand its value. In the key overview below, bars show which items are missing a key and where one key holds both numbers and strings. Your text and files are never sent to a server; everything is processed in this browser.
When to convert between a JSON array and JSONL
- Building an input file for the OpenAI Batch API: a batch job reads each line of a .jsonl file as one request, and every request needs a distinct custom_id. One batch can hold up to 50,000 requests, and the input file can be up to 200 MB. If you built your request list as an array, convert it to JSONL and then check in the key overview that custom_id is marked "All values unique".
- Loading into a data warehouse such as BigQuery: the Google Cloud documentation says the JSON you load must be newline-delimited, with each object on its own line. An array file taken straight from an API does not meet that condition, so convert it to JSONL first.
- Handing accumulated logs to a program that wants one document: a JSONL log that grew one line at a time has to be wrapped into a JSON array before you pass it to a charting tool or JavaScript code that reads a single JSON document.
- Splitting large data for processing: if you cut JSONL by line count, every piece is still valid JSONL. If you cut an array, the brackets and commas break at the cut and each piece needs repairing, so JSONL is the easier choice for data you will send or process in chunks.
Conversion rules
- JSON array → JSONL: each item of the outermost array becomes one line. Only whitespace and line breaks outside strings are removed; number notation, escapes and key order stay exactly as written. Lines end with LF, a final LF is added after the last line as the JSON Lines document recommends, and no BOM is added. An empty array [] has no items, so the result is 0 bytes.
- Wrapped API responses: if the outermost value is an object, the converter searches it for an array (up to 3 levels of keys deep, as in data.items). It picks the array with the most objects first, and the "Array to convert" select in the bar above lets you choose another array or "Whole object as one line".
- JSONL → JSON array: each line is read as one JSON value and becomes an array item. Windows CRLF line endings are accepted. JSON Lines does not treat a blank line as a valid value, so a blank line is reported as an error. You can pick the array layout from 2-space indent, 4-space indent, one item per line, or all on one line.
- Lenient reading: skips blank lines, trailing commas, values indented across several lines and RS separator characters (0x1E), and reads the values one after another. The NDJSON specification allows a parser to ignore blank lines silently, but asks that the behavior be documented and configurable. That is why this option is off by default, and why the error card gives you a button to turn it on at once when an error occurs.
- Automatic direction detection: the direction is adjusted only when you paste into the input box or open a file, which replaces the whole input. A single array in brackets and a single object spread over several lines (a pretty-printed API response) are treated as a JSON array; everything else, including an object written on one line, is treated as JSONL, because a one-line object such as a Batch API request line is one JSONL line. A minified one-line API response is also read as one JSONL line, so to split the array inside it into lines, switch the direction to "JSON array → JSONL". While you type by hand, the direction never changes.
- Value types: JSON Lines allows numbers, strings, arrays and null as well as objects as the value of a line. This converter carries every value across, and the key overview reports separately how many items are not objects.
Example: four orders become four lines of JSONL
This is the array from the first screen, converted to JSONL. The size is the number of UTF-8 bytes without the line break, and lines with the same set of keys get the same shape letter.
| Line | JSONL content | Size | Shape |
|---|---|---|---|
| 1 | {"id":1001,"customer":"Emma","qty":2,"tags":["new","coupon"]} | 61 B | A |
| 2 | {"id":1002,"customer":"Liam","qty":1,"note":"Leave it at the door\nPlease don't ring the bell"} | 95 B | B |
| 3 | {"id":1003,"customer":"Olivia","qty":3,"tags":[]} | 49 B | A |
| 4 | {"id":1004,"customer":"Noah","qty":"2","tags":["regular"]} | 58 B | A |
The indented input array is 310 bytes, and the JSONL result is 267 bytes once the four line breaks are added. The \n you see in the note on line 2 is an escape written inside the string, not a real line break, so the whole object stays on one line. If you wrap the same four lines back into a JSON array, the size depends on the array layout like this.
| Array layout | Size | Good for |
|---|---|---|
| 2-space indent | 421 B | Reviewing the structure by eye |
| 4-space indent | 527 B | Committing to a code repository that uses 4-space indentation |
| One item per line | 282 B | Version control, where a changed item shows up as a one-line diff |
| All on one line | 269 B | Sending the smallest possible payload |
What to check in the key overview
- Shapes A and B: items with the same set of keys get the same letter, and the most common shape is A. In the example, A covers three orders, and only order 2, which has a note and no tags, is B (+note −tags). Pressing a shape chip highlights the lines with that shape in the result panel.
- The bar on a key card: it shows what share of all items contain that key and which value types it holds (number, string, boolean and null, object and array). The empty part of the bar stands for items without the key. Pressing a card that has an empty part highlights the lines where the key is missing.
- Mixed types: in the example, qty is a number in three orders and the string "2" in one. A database or analytics tool that fixes the type of each column can fail or coerce a value like this, so fix it beforehand. null often appears as an empty value, so it is not counted as a mix.
- All values unique: this label goes to a key that is present in every item, holds a single value type and never repeats a value. Use it to check keys that must not collide, such as id or the Batch API custom_id.
- Warnings: numbers outside the safe integer range, items where one object repeats a key, and items that are not objects are reported separately above the key overview.
Common mistakes
| Input | What is wrong | How to fix it |
|---|---|---|
| JSONL with blank lines between the lines | In JSON Lines, a blank line is an error. | Delete the blank lines or turn on "Lenient reading". |
A trailing comma, as in {"a":1}, | It looks like the inside of an array copied as is, so it is not JSONL. | Delete the comma or turn on "Lenient reading". |
| Objects indented over several lines, one after another | A value does not fit on a single line. | Read it with "Lenient reading", or wrap the objects in an array and convert with "JSON array → JSONL". |
{'a': 1, 'b': None} | This is a Python dictionary printed as is. JSON uses only double quotes and null. | Print it again with Python's json module. |
[1, 2,] | JSON does not allow a comma after the last item. | Remove the comma before the closing bracket. |
| A real line break or tab inside a string | JSON requires control characters inside strings to be escaped (RFC 8259 §7). | Write the line break as \n and the tab as \t. |
{"zip": 0012} | A JSON number cannot start with 0. | Write it as a string, like "0012". |
NaN, Infinity | JSON syntax has no such values (RFC 8259 §6). | Replace them with null or a string. |
When an error occurs, the result area shows the line and character where it happened and marks the problem spot in that line. Press "Show position in input" to jump straight to that character in the input box.
Large integers and repeated keys are carried over as written
The JSON standard notes that integers from −(253)+1 to (253)−1 are read the same way by different programs (RFC 8259 §6). The largest integer JavaScript can represent exactly is 9,007,199,254,740,991. This converter does not turn numbers into computable numbers; it copies the characters you wrote, so an order number beyond that range is not changed. A key that appears twice in one object is not removed either. The program that receives the result may still read it differently.
| Input value | Result of this converter | Value read by JavaScript JSON.parse |
|---|---|---|
9007199254740993 | 9007199254740993 | 9007199254740992 |
{"id":1,"id":2} | {"id":1,"id":2} | {"id":2} |
1.50e+3 | 1.50e+3 | 1500 |
"é" | "é" | "é" |
The JSON standard says the behavior of a program that receives an object with a repeated name is unpredictable, and notes that many implementations keep only the last pair (RFC 8259 §4). Python's json module also uses the last value. For that reason, the key overview warns you about the number of items with a repeated key and counts the last value on the key cards. To keep long identifiers from changing on the receiving side, it is safer to handle them as strings, like "9007199254740993".
The JSON Lines and NDJSON specifications, RFC 8259 and 7464, the OpenAI Batch guide, the Google Cloud BigQuery documentation, the Python json documentation and the MDN pages were checked against the originals on 2026-10-20.
Limits and cautions
- Input up to 5 MB (5,242,880 bytes) and output up to 32 MB are converted. A gzip-compressed file (such as .jsonl.gz) is unpacked before reading and measured by its unpacked size. For larger data, split it by lines and process JSONL in pieces.
- The result panel shows the first 400 lines, the first 20,000 characters when you expand a value, up to 24 key cards and up to 8 shape chips. Copying and saving include the whole result.
- The key overview counts only the outermost keys of each item. Keys of objects nested inside an object are not counted.
- Nesting is read up to 512 levels. Files are read as UTF-8 (a leading BOM is removed), and UTF-16 files with a BOM are read too. Saved files are uncompressed UTF-8 without a BOM.
- JSON text sequences (RFC 7464), which separate values with the RS character, can only be read with "Lenient reading"; this tool does not write that format.
- This converter checks only JSON syntax. Check the keys the receiving program requires (such as custom_id) and its data types against that service's documentation.
Sources
- 01JSON LinesOne valid JSON value per line (any value is allowed, a blank line is not valid), lines end with '\n' ('\r\n' is also read), a final line terminator is recommended, no BOM, extensions .jsonl and .jsonl.gz — checked 2026-10-20
- 02NDJSON — Newline Delimited JSON specification'\n' or '\r\n' separators, blank lines may be ignored silently (MAY, documented and configurable), media type application/x-ndjson, extension .ndjson
- 03IETF — RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format§4 names within an object SHOULD be unique and the behavior with duplicates is unpredictable, §6 interoperable integers [−(253)+1, (253)−1] and no Infinity or NaN, §7 control characters must be escaped, §8.1 BOM
- 04IETF — RFC 7464: JavaScript Object Notation (JSON) Text SequencesEach value is preceded by an RS character (0x1E), media type application/json-seq
- 05OpenAI — Batch API guideEach line of the .jsonl file is one request, each request needs a unique custom_id, up to 50,000 requests per batch and a 200 MB input file
- 06Google Cloud — Loading JSON data from Cloud Storage (BigQuery)JSON data must be newline-delimited (ndJSON) with one object per line; ndJSON is the same format as JSON Lines
- 07Python documentation — json: JSON encoder and decoderWhen a name is repeated within an object, only the value of the last name/value pair is used
- 08MDN — Number.MAX_SAFE_INTEGERThe largest safe integer in JavaScript, 253 − 1 = 9,007,199,254,740,991
- 09MDN — JSON.parse()JSON numbers become JavaScript numbers and can lose precision; large numbers can be exchanged as strings
Frequently asked questions
How do I convert a JSON array to JSONL?
Paste the JSON array into the input box above or open a file, and the result box shows JSONL with one item per line at once. Copy it with the copy button or download a .jsonl file with the Save JSONL button. If you paste JSONL instead, the direction switches to 'JSONL → JSON array' and the lines are wrapped into an array.
Can I just rename a .json file to .jsonl?
No. Renaming the file leaves the content as an array, with the outer brackets and the commas between items. JSONL needs one value per line without brackets, so the items must be split into lines and rewritten, which is what this converter does.
What if the API response is wrapped, like {"data": [...]}?
A pretty-printed (multi-line) response can be pasted as is: if the outermost value is an object, the converter finds the arrays inside (up to 3 key levels) and converts the one with the most objects to JSONL. A minified one-line response is read as one JSONL line, so choose the 'JSON array → JSONL' direction. To use another array or turn the whole object into one line, pick it in 'Array to convert' in the bar above.
What happens if there is a blank line in the middle of JSONL?
By JSON Lines rules a blank line is an error, so the converter tells you which line it is. Delete the blank line, or press the 'Lenient reading' button on the error card to skip blank lines and wrap the values into an array. A single line break after the last line is not an error.
I pasted objects indented over several lines and get an error.
JSONL needs each value entirely on one line, so an object indented over several lines fails with the error that the value does not end on its first line. Turn on 'Lenient reading' to read the values one after another regardless of lines and wrap them into an array, and converting that array back to JSONL gives one tidy line per item.
Can a number or a string that is not an object be a line too?
Yes. JSON Lines allows numbers, strings, arrays and null as well as objects as the value of a line, so this converter carries them across as they are. Many tools accept only objects, so the key overview reports how many items are not objects.
Will long numbers or repeated keys be changed?
No. Numbers are not turned into computable numbers; the characters you wrote are copied, so a large integer like 9007199254740993 and a notation like 1.50e+3 stay as they are, and a key that appears twice is not removed. The receiving program may round a large number or keep only the last key, so the key overview shows a warning.
Is my JSON or file stored on a server?
No. The conversion happens only in this browser, and your text and files are never sent to a server. When you close the page, your input is gone too.