b2KIT

NDJSON / JSON Lines Tool

Parse, validate, and convert Newline-Delimited JSON (NDJSON / JSON Lines) to arrays or CSV.

Tested tool guide Tested browser tools Checked August 16, 2026

What NDJSON / JSON Lines Tool does, with a checked example

NDJSON / JSON Lines Tool reads text containing one complete JSON value per line, checks whether each record is valid JSON, and converts the resulting sequence to a JSON array or CSV. It is suited to line-oriented exports, logs, and streaming data that are not already enclosed in array brackets. A common mistake is pasting pretty-printed JSON: an object spread across several lines is not one NDJSON record because every record must fit on a single line.

Worked example

A concrete input and expected output from the current implementation.

Input

{"name":"Ada","score":7}
{"name":"Lin","score":9}

Expected output

[
  {
    "name": "Ada",
    "score": 7
  },
  {
    "name": "Lin",
    "score": 9
  }
]

In JSON array mode, the two lines become two array elements in their original order. The names, property names, and numeric scores remain unchanged; only the surrounding array structure and separators are added.

How the result is produced

1

Line-by-line parsing

Each input line represents an independent JSON value rather than part of a larger JSON document. Objects, arrays, strings, numbers, booleans, and null are valid records when written as valid JSON. Property names and string values require double quotes. Single quotes, comments, trailing commas, bare identifiers, or an object split over multiple lines are not valid NDJSON records.

2

Array and CSV conversion

JSON array conversion places the parsed records inside one array while preserving their order and JSON value types. CSV conversion is intended for row-like object records, where properties can be represented as fields. Because CSV has no native JSON types or nested structures, arrays, objects, null values, and inconsistent property sets may not carry the same meaning after conversion.

Good uses

  • Turn a line-oriented API export into one JSON array that can be opened by software expecting a conventional JSON document.
  • Validate an .ndjson or .jsonl log before importing it, especially when one malformed record may be hidden among otherwise valid lines.
  • Convert flat object records such as names, identifiers, and numeric measurements into CSV for review in a spreadsheet.

Limits and checks

  • An empty line is not itself a valid JSON value. Remove accidental blank records rather than assuming every NDJSON reader will ignore them.
  • Duplicate property names inside one object are not safely portable. Their interpretation can differ, so fix them before trusting validation or conversion results.
  • CSV is not a lossless substitute for arbitrary JSON. Check nested values, missing properties, nulls, strings containing delimiters, and distinctions between numbers, booleans, and text.

Common questions

Is NDJSON the same format as a JSON array?

No. NDJSON contains separate JSON values divided by line endings, with no surrounding square brackets and no commas between records. A JSON array is one complete JSON value whose elements appear inside brackets and are comma-separated. This tool bridges those structures, but software that accepts one format does not necessarily accept the other.

Will CSV conversion preserve nested objects and arrays?

Not necessarily. CSV provides rows and fields, but it has no standard representation for nested JSON, arrays, null, or JSON-specific value types. The tool can convert suitable records, but you should inspect any complex cells and uneven rows. Use the JSON array output when preserving the complete JSON structure matters.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools