Skip to main content

JSON format mismatch

Convert NDJSON to a JSON Array or CSV

Recognize newline-delimited JSON, avoid the extra-data parse error, and convert one-object-per-line data correctly.

Use the matching tool

NDJSON to CSV

Open NDJSON to CSV

What the error actually means

NDJSON contains one complete JSON value per line. A standard JSON parser reads the first object successfully, then reports extra data when it encounters the next object. The file is not necessarily corrupted; it is a different serialization format.

Likely causes

  • A logging or streaming system exported JSON Lines.
  • A .json extension was used for an NDJSON file.
  • Multiple API responses were appended without surrounding array brackets.
  • A converter expects an array of objects but received independent records.

Record framing

Problem

{"id":1}
{"id":2}

Correct pattern

[{"id":1},{"id":2}]

A safe repair workflow

  1. 1Confirm that each non-empty line is valid JSON on its own.
  2. 2Use the NDJSON converter rather than wrapping raw text with brackets manually.
  3. 3Choose CSV when the records have a reasonably consistent object shape.
  4. 4Review how nested objects and arrays were represented in the output.

How to verify the result

A file that downloads successfully is not automatically a correct file. Check the result at both the structural and business-data levels:

  • The output record count equals the number of valid input lines.
  • No first or final record is missing.
  • Nested values use an intentional flattening strategy.
  • Invalid lines are reported rather than silently skipped.

Read the deeper guides