JSONL to JSON Converter (NDJSON)

Parse one JSON object per line and collect the records into a standard JSON array.

Convert JSONL and NDJSON to a JSON array

JSON Lines, often called JSONL or NDJSON, stores one complete JSON value on each line with no enclosing brackets and no commas between records. This converter reads those records and returns a standard, pretty-printed JSON array that can be inspected, diffed, queried or passed to any tool that expects ordinary JSON.

JSONL suits writing and streaming: a logger can append a line at a time and a loader can process a file without holding all of it in memory. A JSON array suits reading: browsers, viewers, test fixtures and most REST clients want a single document. Converting JSONL to JSON is the bridge between the two.

How to use the converter

  1. Paste your JSON Lines into the JSONL input box. For a large export, paste a sample such as the first few hundred lines.
  2. Click Convert. Each non-blank line is trimmed and parsed on its own.
  3. The JSON array box shows every record, in the original order, formatted with two-space indentation.
  4. Click Copy to take the array to your editor, or Clear to start again.

Worked examples

1. Application log lines

Structured loggers write one event per line. Input:

{"ts":"2026-10-01T09:00:00Z","level":"info","msg":"server started","port":8080}
{"ts":"2026-10-01T09:00:02Z","level":"error","msg":"db timeout","retry":3}

Output:

[
  {
    "ts": "2026-10-01T09:00:00Z",
    "level": "info",
    "msg": "server started",
    "port": 8080
  },
  {
    "ts": "2026-10-01T09:00:02Z",
    "level": "error",
    "msg": "db timeout",
    "retry": 3
  }
]

Records do not need the same keys: the second event has retry and no port, and both are kept exactly as written.

2. Mixed values and blank lines

Any JSON value is allowed on a line, and the empty line is skipped:

1
"two"

[3, 4]
{"five": 5}
null

becomes

[
  1,
  "two",
  [
    3,
    4
  ],
  {
    "five": 5
  },
  null
]

3. Batch API results

LLM batch jobs return one result per line. Converting them to an array makes it easy to scan status codes in the JSON viewer or filter them with JSONPath:

{"custom_id":"req-1","response":{"status_code":200,"body":{"id":"msg_01"}}}
{"custom_id":"req-2","response":{"status_code":429,"body":{"error":"rate_limited"}}}

Common errors and edge cases

When to convert, and which tool next

Keep data as JSONL when it is uploaded for fine-tuning, loaded into BigQuery, sent to the Elasticsearch bulk API or appended by a logger. Convert JSONL to JSON when you need to read it, compare two exports in the JSON diff checker, explore it with the jq playground, flatten it into a spreadsheet with JSON to CSV, or infer a contract with the JSON Schema generator. To go the other way, turn an array back into one record per line with the JSON to JSONL converter.

FAQ

Is JSONL the same as NDJSON?

In practice, yes. JSON Lines (.jsonl) and newline-delimited JSON (.ndjson) both mean one complete JSON value per line, separated by a line feed. This converter accepts either, and also tolerates Windows \r\n line endings.

Why does my JSONL file fail on the very first line?

Usually because it is not really JSONL. A pretty-printed record that spans several lines, or a file that is already one big JSON array, cannot be read line by line. Minify each record onto its own line, or check the whole file with the JSON validator instead.

Are blank lines allowed?

Yes. Empty and whitespace-only lines are skipped, and spaces around each record are trimmed before parsing, so a trailing newline at the end of the file does no harm.

Can a line hold an array, a number or a string instead of an object?

Yes. Every line is parsed with the standard JSON parser, so any JSON value is accepted and copied into the output array as-is. Most JSONL producers write objects, but nothing here requires it.

How do I convert a very large NDJSON file?

The page holds the whole input in memory, which is fine for a few megabytes. For multi-gigabyte exports use the command line: jq -s . data.jsonl > data.json slurps every line into one array.

Is my data uploaded?

No. Splitting and parsing happen in your browser with JavaScript; the records never leave the page.