Ready
Ln 1, Col 1Blog

Tool Kumar tool

NDJSON to JSON

Paste NDJSON or open a .jsonl file to turn its lines into a single JSON array. The input keeps its lines, and the formatted array appears beside it, ready to copy or download as .json.

How to use this tool

  1. Paste the lines, or open a .ndjson or .jsonl file.
  2. Read the array in the Format view, and switch between Pretty and Minify.
  3. Copy it, or download it as a .json file.

Worked example

Each of the three lines becomes one element of the array. The order numbers keep every digit; JSON.parse in JavaScript would round 9007199254740993 to 9007199254740992.

Input · orders.ndjson

{"order":9007199254740993,"item":"keyboard","qty":1}
{"order":9007199254740994,"item":"cable","qty":3}
{"order":9007199254740995,"item":"mouse","qty":2,"gift":true}

Output

[
  {
    "order": 9007199254740993,
    "item": "keyboard",
    "qty": 1
  },
  {
    "order": 9007199254740994,
    "item": "cable",
    "qty": 3
  },
  {
    "order": 9007199254740995,
    "item": "mouse",
    "qty": 2,
    "gift": true
  }
]

Options and edge cases

  • Each line becomes one array element, in file order. A line that holds an array stays one element, so the lines [1,2] and [3] become [[1,2],[3]].
  • Blank lines are skipped. A line that is not strict JSON is flagged with its line and column: loose syntax such as a trailing comma can be repaired, and text that cannot be read stops the conversion.
  • A single pasted line is ordinary JSON and stays as it is. Open it as a .jsonl or .ndjson file to get a one-element array.
  • Numbers keep their source digits, including integers beyond 2^53.
  • To replace the input with the array, choose Use as input in the More options menu (Ctrl+Enter). Ctrl+Z undoes it.

Private by default

Your document stays in this browser. Tool Kumar parses, converts and creates downloads on your device, with no account or upload step.

NDJSON to JSON questions

How do I convert NDJSON to JSON?
Paste the NDJSON or open the file. The Format view shows a JSON array with one element per line; copy it or download it as .json.
How do I convert JSONL to JSON?
The same way. JSONL and NDJSON are two names for one format, and this converter reads both .jsonl and .ndjson files.
What happens to an invalid line?
It is flagged with its line and column. Loose syntax such as single quotes can be repaired with Repair input; a line that cannot be read stops the conversion until you fix it.
Can I convert the other way?
Yes. JSON to JSONL turns an array of records back into one compact JSON value per line.

Related tools

JSON to JSONL, JSONL viewer, JSONL to CSV.