Data ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Data Tools

JSONL Formatter and NDJSON Validator

Validate JSON Lines and NDJSON line by line with exact line numbers and errors, pretty-print or compact each record, and convert between JSONL and JSON arrays.

View all tools
ResultUpdates as you type
{
  "id": 1,
  "name": "Alice",
  "roles": [
    "admin"
  ]
}

{
  "id": 2,
  "name": "Bob",
  "active": false
}

{
  "id": 3,
  "name": "Carol",
  "tags": [
    "new",
    "beta"
  ]
}

3 valid records, 1 blank line skipped.

How to use JSONL Formatter and NDJSON Validator

Paste JSON Lines, a JSON array or several pretty-printed documents. Choose Pretty-print, Compact JSONL, Convert to a JSON array or Validate only; the result and any line errors update as you type.

  1. Paste JSONL or NDJSONPaste one JSON value per line. A JSON array or a run of pretty-printed objects is detected automatically too.
  2. Pick an outputChoose Pretty-print each record, Compact JSONL, Convert to a JSON array or Validate only, plus indent and Sort keys A–Z.
  3. Fix errors, then copyInvalid lines are listed with line number and error. Fix them or tick Skip invalid lines, then press Copy result.

JSON Lines versus a JSON array

In JSON Lines, also called NDJSON, every line is a complete JSON value on its own: no surrounding square brackets and no commas between records. That makes it easy to append to log files, stream records one at a time and split large exports, and it is the format many bulk import tools, BigQuery loads and machine-learning datasets expect. A JSON array keeps all records inside one pair of brackets, which most programs can read in one go. Pasting [{"id":1},{"id":2}] with Compact JSONL selected returns {"id":1} and {"id":2} on separate lines, and Convert to a JSON array does the reverse.

Finding and fixing invalid lines

Each non-blank line is parsed separately and keeps its original line number, so an error on line 2 does not shift the numbers of later lines. The error table lists the line, the parser's message and the start of the offending text; a line such as {id:2} fails because the key lacks double quotes. By default nothing is output while any line is invalid. Tick Skip invalid lines and keep going to output only the valid records, with the skipped line numbers listed. Validate only shows counts of records, valid lines, invalid lines and blank lines, and blank lines are skipped rather than treated as errors.

Accuracy and data handling

Keep the original data and spot-check fields, types and delimiters before using an important conversion. The calculation runs in your current browser; the tool code does not send the input to a processing API.

Often Used Together

Next step

FAQ

What is the difference between JSONL and NDJSON?

Practically none. Both store one complete JSON value per line, separated by newlines. JSON Lines and newline-delimited JSON are two names for the same convention, and files may end in .jsonl or .ndjson.

How do I convert a JSON array to JSONL?

Paste the array, leave Input on Detect automatically and choose Compact JSONL (one record per line). Each element of the array becomes its own line, ready to save as a .jsonl file.

How do I find which line is broken?

Original line numbers are kept, and every invalid line is listed with its number, the parse error and the start of its content. Fix the lines and the result updates as you type.

Can I sort the keys in every record?

Yes. Tick Sort keys A–Z and the keys of every object, including nested ones, are sorted by character code in the output. The order of array items is not changed.

More Data Tools

Related tools