Skip to content
UniKit

JSON Lines formatter

Validate and format JSON Lines (NDJSON): every line is checked for valid JSON with the offending line number reported, records can be emitted as compact NDJSON or a pretty JSON array, and object keys can be sorted recursively.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Formatted result

What this tool does

  • Sanity-check an NDJSON log or export before importing it: every broken line is reported with its line number.
  • Expand one-JSON-per-line data into a readable JSON array you can fold and inspect in an editor.
  • Turn a JSON array into NDJSON for log pipelines, Fluentd and tools that stream line by line.
  • Normalise field order: enable recursive key sorting so every record lines up by name and diffing against the previous export becomes trivial.

Example

Input

{"id":1,"name":"a"}
{"id":2,"name":"b"}
{"id":3,"name":"c"}

Output

{"id":1,"name":"a"}
{"id":2,"name":"b"}
{"id":3,"name":"c"}

The default output is NDJSON, one record per line with a trailing newline. Switch the output to "JSON array" to get a pretty-printed array, and enable sorting to order the object keys of every record recursively.

Frequently asked questions

Do blank lines and trailing spaces count as errors?

No. Blank lines are ignored and counted separately, and each line is trimmed before parsing, so data copied out of an editor or a log does not produce false positives.

What if the whole file is actually one JSON array?

It is detected and expanded into records, then emitted in the format you picked. If the array itself is malformed, the tool falls back to per-line validation and still reports line numbers instead of throwing away all line information.

Why does the error only mention a line, not a column?

Because the unit of an NDJSON file is the line. Errors say which line failed and why: an unexpected character, an unexpected end, extra content after the JSON value, and so on. Only the first error is reported; fix it and parse again for the next one.

Are NDJSON and JSON Lines the same thing?

Basically two names for the same format: one complete JSON value per line with no shared structure between lines. The differences are small conventions — NDJSON usually requires UTF-8 and a newline at the end of each line, which is what this tool emits, while some consumers want the last line without a trailing newline.

Is my data uploaded anywhere?

No. Parsing, validation and formatting all happen in your browser, no network request is made and it works offline, so log contents never leave your machine.

Keywords:jsonlndjsonjson linesjsonl 格式化ndjson 校验每行一个 jsonjson array格式校验line numberformatter

Related tools