JSON to JSON Lines Converter (JSONL / NDJSON)
Data ToolsTurn a JSON array into JSON Lines, one object per line, or combine JSON Lines back into an array.
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
About
What the JSON to JSON Lines Converter does
The JSON to JSON Lines Converter turns a JSON array into JSONL, also called NDJSON: one compact JSON value per line. The other direction reads JSON Lines and returns a JSON array, skipping blank lines and listing any invalid lines by number instead of rejecting the whole file. Swap converts the result back.
Steps
How to use it
- 1Choose JSON → JSONL or JSONL → JSON.
- 2Paste the data or upload a .json or .jsonl file.
- 3Press Convert, then download the .jsonl or .json file.
Example
A real run
Input
[
{"ts": "2026-11-27T10:00:00Z", "level": "info", "msg": "server started"},
{"ts": "2026-11-27T10:00:02Z", "level": "warn", "msg": "slow query", "ms": 812},
{"ts": "2026-11-27T10:00:05Z", "level": "error", "msg": "payment declined"}
]Output
{"ts":"2026-11-27T10:00:00Z","level":"info","msg":"server started"}
{"ts":"2026-11-27T10:00:02Z","level":"warn","msg":"slow query","ms":812}
{"ts":"2026-11-27T10:00:05Z","level":"error","msg":"payment declined"}Each log event becomes one compact line; the extra ms field on the second event is kept, because every line is an independent JSON object.
Options
Every setting, and when to use it
- Direction and Swap
- JSON → JSONL needs an array at the top level; each item becomes one line. JSONL → JSON reads one value per line. Swap converts the output back for a quick check.
- Pretty-print the array
- For JSONL → JSON: indented output for reading, or compact output on one line for the smallest file.
Good to know
Common problems and limits
Files up to 50 MB. Very large files are slow to paste; uploading is faster.
Invalid lines are skipped and listed with their line numbers and the parser's message, so one broken record does not stop the rest. Blank lines are ignored.
Each JSONL line is written compactly with no extra spaces. To inspect one record in detail, paste it into the JSON Formatter.
Audience
Who uses it
- AI and ML engineersPrepare batch request files and fine-tuning datasets in .jsonl, or turn batch results back into a JSON array for analysis.
- Data engineersMove records between tools that stream JSON Lines, such as BigQuery loads, Elasticsearch bulk files and log pipelines, and tools that expect an array.
- Backend developersConvert structured logs into an array to search or chart them, or split an export into lines for line-by-line processing.
FAQ
Frequently asked
What is JSON Lines (JSONL or NDJSON)?
A text format with one complete JSON value per line, usually an object, separated by newlines. JSON Lines and NDJSON (newline-delimited JSON) describe the same idea. Because each line stands alone, files can be appended to, streamed and processed one record at a time.
Why do AI APIs use JSONL files?
Batch and fine-tuning jobs handle many independent records, and JSONL lets a service read them one line at a time. OpenAI's Batch API and fine-tuning take .jsonl files, and Anthropic's Message Batches API returns its results as JSON Lines. Convert your array here, then follow the provider's required fields for each line.
JSONL or a JSON array: which should I use?
Use a JSON array for small to medium data that a program loads all at once, such as an API response. Use JSONL for large or growing data: logs, exports and datasets, where you append records or process them without loading everything into memory.
How do I open a large JSONL file?
Most text editors open JSONL as plain text, one record per line. For analysis, convert it to a JSON array here, or turn it into a spreadsheet with JSON to CSV. On the command line, jq -s . file.jsonl combines the lines into an array.
Why were some lines skipped?
Those lines are not valid JSON on their own, often because a record was split across lines or cut off. The note lists their line numbers and the parser's message; fix them and convert again, or keep the result without them.
Is my data sent anywhere?
No. The conversion runs in your browser. A copy of each run is saved to your past runs so you can reopen it, limited to the first 512 KB.
Automation: an MCP tool json_to_jsonl(json), jsonl_to_json(text) and an n8n node are planned for this tool.