Dev TooloraLocal dev tools

> Formatters

JSON Lines ↔ JSON Array

Convert JSON Lines (JSONL, NDJSON) to a JSON array and back.

Runs locallyWorks offline
Back to results
Input

Source data

Mode
Output

Result

Your result will appear here.

Tool guide

About this tool.

JSON Lines (also called JSONL or NDJSON) stores one JSON value per line, separated by a line break. It is common for logs, exports and streaming APIs because a file can be read and appended one record at a time.

JSONL to array parses every non-blank line on its own and collects the values into one JSON array. Blank and whitespace-only lines are skipped and counted. Line breaks can be LF, CRLF or CR, and a leading UTF-8 byte order mark is ignored.

Array to JSONL does the reverse: the top-level array becomes one minified value per line.

  • Load an exported .jsonl log into a tool that expects one JSON array.
  • Turn an API response array into a file you can stream or grep line by line.
  • Find the broken record in a large export: the error names the physical line number.
  • Prepare data for bulk import endpoints that accept NDJSON.

Choose a direction. JSONL to array parses each line and returns a JSON array, with the indentation you pick or Minified.

Array to JSONL expects a top-level JSON array and writes one minified value per line.

In JSONL mode an invalid line stops the conversion and the error shows its line number, counting blank lines, so it matches your editor.

The summary shows how many records were read and how many blank lines were skipped.

  • {"a":1}⏎{"a":2} → [{"a":1},{"a":2}] with Minified indentation.
  • [1,{"b":2}] → 1⏎{"b":2} in Array to JSONL mode.
  • {"a":1}⏎⏎{"a":2} → 2 records · 1 blank lines skipped.
  • {"a":1}⏎{bad → Line 2 is not valid JSON.
  • A record can be any JSON value, not only an object: 1⏎"text"⏎[1,2] is valid.

  • Runs locally and offline; the input is never uploaded.
  • Input is limited to 10,000,000 UTF-16 units and 100,000 lines.
  • A duplicate key keeps its last value, as JSON.parse does, and the summary names the key and line.
  • A number beyond the range of a double, such as 1e400, or one that would become 0, such as 1e-400, is rejected.
  • Numbers a double cannot hold, such as 12345678901234567890, keep their exact digits.
  • A textarea may normalize CRLF to LF; the result is the same either way.

FAQ

Questions about JSON Lines ↔ JSON Array

What is JSONL?

JSONL is a text format with one complete JSON value on each line. Files can be appended to and read record by record without loading the whole document.

Why are the output lines minified?

Each record must stay on one physical line, because a line break is the separator between records. Pretty-printed JSON would split a record across lines and break the format.

How is this different from the JSON Lines Inspector?

The JSON Lines Inspector profiles a log: fields, types and bad lines. This tool converts the data to a JSON array or back, and stops with an error at the first invalid line.

Continue with

JSON Lines InspectorInspect JSONL records, malformed lines and top-level field presence.JSON FormatFormat, minify or validate JSON without rounding numbers, rewriting strings or dropping duplicate keys.JSON TableInspect JSON records in a searchable table and export safe Markdown without rounding numbers.JSON ↔ CSV ConverterConvert JSON records to CSV or TSV and CSV back to JSON, with quoted headers, multiline cells, leading zeros and an explicit separator.