Developer Tools
JSON Lines Converter
Convert between JSON arrays and JSON Lines / NDJSON.
Converted output
Pretty-printed JSON array
No output yet
About This Tool
JSON Lines stores a sequence of independent JSON values with one complete JSON value on each line. It is often called JSONL or newline-delimited JSON (NDJSON) and is convenient for logs, streaming records, command-line pipelines, machine-learning datasets, and large record-oriented exports. This converter changes a line-oriented document into an ordinary JSON array, or serializes each item in a JSON array onto its own compact line. Conversion happens locally in the browser.
How To Use It
- Choose JSON Lines → JSON when your source contains one complete JSON value per line, or JSON → JSON Lines when your source is a top-level JSON array.
- Paste the source text. In JSON Lines mode, each non-blank line is parsed independently; enable Ignore blank lines when spacing between records should be skipped.
- Select Convert. Malformed JSON Lines input reports the physical line containing the invalid record instead of silently omitting it.
- Review and copy the output. JSON array output is indented for readability, while JSON Lines output is deliberately compact so each array item occupies exactly one line.
Examples
API records to JSON array
Two lines such as {"id":1} and {"id":2} become a standard JSON array containing those two objects, which can then be inspected with the JSON Formatter or consumed by software expecting one JSON document.
JSON array to NDJSON
An array containing three objects becomes three independent compact JSON object lines. No commas or surrounding square brackets are written between records.
Primitive JSON values
JSON Lines records do not have to be objects. Valid lines such as 42, true, null, "hello", or [1,2] remain those JSON values when collected into the output array.
Find a malformed record
If line 18 contains invalid JSON, conversion stops with a line-18 error. This is more actionable than attempting to parse the entire line-oriented file as one JSON document.
Useful Notes
JSON Lines is not a JSON array
A JSON array uses square brackets and commas between items. JSON Lines instead places a complete JSON value on each line and does not use a surrounding array. As a result, a multi-record JSONL document is not itself one standard JSON value even though every individual record is valid JSON.
One record must stay on one line
In JSON Lines input, an individual record cannot be pretty-printed across multiple physical lines because the newline is the record boundary. Objects and arrays can still be nested, but each complete record must serialize onto a single line.
Blank-line behavior
Blank lines are commonly absent from JSON Lines data, but real files may contain accidental spacing. The Ignore blank lines option skips lines containing only whitespace. Disable it when you want blank lines treated as structural errors and reported with their line number.
JSON to JSON Lines requires an array
The reverse direction requires a top-level JSON array because the array provides an unambiguous sequence of records. Each array item is serialized with JSON.stringify onto exactly one output line. An empty array therefore produces an empty JSON Lines document.
Data fidelity and limits
The converter uses the browser's JSON parser and serializer, so JSON strings, numbers, booleans, null, arrays, and objects retain their JSON meaning. As with ordinary JavaScript JSON parsing, extremely large integer literals can exceed exact IEEE-754 number precision. For identifiers that must retain every digit, encode them as JSON strings before conversion.
Local processing
Pasted data is parsed and transformed in browser JavaScript and is not sent to an API by this tool. Very large datasets can still consume significant browser memory because this implementation builds the converted result in memory rather than providing a streaming file pipeline.
FAQ
Are JSONL and NDJSON the same thing here?
For this tool, both names refer to the common one-JSON-value-per-line representation. The converter does not depend on a filename extension.
Can a JSON Lines record span several lines?
No. This converter treats each physical non-blank line as one complete JSON value. Pretty-printed multiline objects should first be represented as an ordinary JSON array or compacted so each record occupies one line.
Does every record have to use the same object fields?
No. Each line is parsed independently and can contain any valid JSON value. Object records may have different keys because JSON Lines itself does not impose a table schema.
Why does JSON to JSON Lines require an array?
A top-level array explicitly identifies the sequence of records to write. Accepting an arbitrary object and guessing whether its properties or the object itself should become records would be ambiguous.
Is the data uploaded?
No. Conversion is performed locally in the browser without a conversion API.
Related Tools
JSON Formatter & Validator
PopularValidate JSON, pretty-print it, minify it, and inspect JSON paths.
CSV & JSON Converter
Convert structured CSV and JSON data in either direction.
JSON Pointer Evaluator
Navigate JSON with standard slash-separated JSON Pointers.
JSON to TypeScript Generator
Infer TypeScript types from JSON sample data.