NDJSON formatter and validator

Helps you read long log records and check NDJSON files before loading them into a database or analytics service.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter ndjson and mode.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Every non-empty line is parsed as JSON. Pretty mode shows each record indented by 2 spaces with a blank line between records; compact mode writes each record on one line with no spaces, dropping extra whitespace and blank lines.

Example

Inputs: Mode = Pretty-print. Result: Result: { "level": "info", "msg": "server started", "port": 8080 } { "level": "error", "msg": "db timeout", "retry": true }; Valid records: 2; Blank lines skipped: 0.

{"level":"info","msg":"server started","port":8080}
{"level":"error","msg":"db timeout","retry":true}
{
  "level": "info",
  "msg": "server started",
  "port": 8080
}

{
  "level": "error",
  "msg": "db timeout",
  "retry": true
}

Limits and caveats

  • Pretty output is for reading only and is not valid NDJSON; use compact mode to save.
  • It stops at the first invalid line and reports its number.

Questions about this tool

How is this different from the JSON Lines to array converter?

This keeps each record separate and pretty-prints or compacts it; the converter gathers all records into one JSON array.

Can compact mode clean up a file?

Yes. It removes extra spaces and blank lines and leaves exactly one line per record.

What extension do NDJSON files use?

Usually .ndjson or .jsonl, with the media type application/x-ndjson.