JSONL / NDJSON ↔ JSON Converter
FormatEverything runs locally in your browser — nothing is uploaded
Combine JSONL (also called NDJSON — one JSON value per line) into a JSON array, or split a JSON array into lines. Logs, data exports and streaming APIs produce this format constantly. “One JSON value per line” is the whole convention, so this parses line by line and names the failing line — in a file of thousands of lines, “parse failed” tells you nothing. Blank lines are skipped (a trailing newline is normal), and CRLF and BOM are handled. ⚠️ A common mistake: pasting a pretty-printed multi-line JSON object will not work. It looks similar, but it is not JSONL — every line has to be a complete JSON value *on its own*. That case produces a clear error explaining why. ⚠️ One precision limit this cannot fix: integers beyond 2^53 do not fit in JSON (Twitter-style snowflake IDs are the classic case), and `JSON.parse` turns `9007199254740993` into `...992`. That is fundamental to JSON and JavaScript, and affects every tool built on `JSON.parse`. If your data contains such IDs, have the source emit them as strings.
Features
- Both directions: JSONL → JSON array, and JSON array → JSONL
- Parsed line by line, with the failing line number reported (counting skipped blank lines, so it matches your file)
- Blank lines skipped; CRLF and LF both accepted; a leading BOM stripped
- Pasting pretty-printed multi-line JSON produces a clear error explaining that each line must be a complete JSON value
- JSON → JSONL verifies the top level is an array rather than quietly emitting one line
- Newlines inside strings are escaped, so every output line stays independently parseable
- JSON indent of 2 or 4 spaces, a tab, or a single line
How to use
- Paste JSONL, or paste a JSON array
- Multi-line JSONL is detected automatically; a single-line JSON object needs the direction set by hand
- The result updates as you type
- Copy the result
FAQ
- Why does it want an array when I paste JSON?
- Because “a JSON document” and “one line of JSONL” look identical — a lone `{"a":1}` is both a valid JSON document and a valid single line of JSONL, and nothing can disambiguate that automatically. So in auto mode, anything that parses as JSON is treated as JSON → JSONL, and that direction requires the top level to be an array (one element per line). To treat a single object as one line of JSONL, set the direction to “JSONL → JSON” by hand.
- Why did my pretty-printed JSON fail?
- Because it is not JSONL. The JSONL convention is that each line is a complete JSON value on its own, and pretty-printed JSON splits one object across many lines — the first line, `{`, is not valid JSON by itself. This tool parses line by line, so it fails on line 1 and says so. Either compact that JSON to a single line first (the JSON formatter here has a “compact” option), or paste it as an array and let it take the other direction.
- Will large integers (Twitter IDs, say) lose precision?
- Yes — and this tool cannot prevent it. Integers beyond 2^53 have no exact representation in JavaScript numbers, and `JSON.parse` turns `9007199254740993` into `9007199254740992`, quietly losing the last digits. This is fundamental to JSON and JavaScript rather than a flaw in this implementation: anything built on `JSON.parse` behaves the same, including `response.json()` in the browser. The only fix is for the source to emit such IDs as strings (`"9007199254740993"`), which preserves every digit.
- Do blank lines become empty records?
- No, they are skipped. A trailing newline, or extra blank lines between records, is normal when editing, and turning them into `null` or empty-string records would only pollute the data. Leading and trailing whitespace on each line is trimmed for the same reason — it cannot affect the content, because whitespace carries no meaning in JSON.
Related tools
JSON Formatter
FormatFormat, validate and minify JSON in a collapsible tree with syntax highlighting and line numbers. Search, edit, delete or convert to Python dicts.
CSV Converter
FormatConvert CSV / TSV and JSON both ways: delimiter detection, correct quoting and embedded newlines, Excel BOM stripped, numbers only when lossless.
JSON to Code
FormatTurn JSON into TypeScript interfaces, Go structs, Java classes or Rust structs, with missing keys marked optional. Runs locally in your browser.
SQL Formatter
FormatFormat SQL online: one clause per line, consistent keyword case, subqueries indented deeper. Minify strips comments and extra whitespace, all locally.
JSON5 Converter
FormatParse JSON5 into strict JSON: comments, unquoted keys, single quotes, trailing commas, hex and Infinity all work, with errors located by line.
XML Formatter
FormatFormat XML online by tag level, with comments, CDATA and DOCTYPE on their own lines and attribute values left untouched. Runs locally in your browser.