FormatterHQ

JSONL to JSON Converter

Convert JSON Lines (NDJSON) into one formatted JSON array. Each line is parsed separately, blank lines are skipped and a broken record is reported with its line number.

Input TEXT
Output JSON
Ready.

How to use the JSONL to JSON Converter

  1. Paste your JSON Lines, upload a .jsonl or .ndjson file, or click Sample for a few log records.
  2. Choose an Indent for the resulting array.
  3. Click JSONL → JSON; the status bar shows how many records were parsed.
  4. If a record is broken, go to the line shown, fix it and convert again. Copy or download the array when done.

Convert JSONL to JSON

JSON Lines files are easy for programs to stream but awkward for people to read and for many tools to import. A JSONL to JSON conversion parses every line as its own JSON value and collects the results into one formatted array, the shape most editors, viewers, test fixtures and APIs expect.

Example: structured log records

{"ts":"2024-05-01T10:00:00Z","level":"info","msg":"server started"}
{"ts":"2024-05-01T10:00:05Z","level":"error","msg":"db timeout"}

Converted with a 2-space indent ("2 records parsed"):

[
  {
    "ts": "2024-05-01T10:00:00Z",
    "level": "info",
    "msg": "server started"
  },
  {
    "ts": "2024-05-01T10:00:05Z",
    "level": "error",
    "msg": "db timeout"
  }
]

Line-by-line parsing and error reporting

Because every line is parsed on its own, a problem in one record is reported precisely. The message names the record and the line number in your file, counting blank lines, so it matches what you see in the editor. For example, this input:

{"ts":1,"level":"info"}

{"ts":2,"level":"warn"}
{"ts":3,"level":error}

fails with Invalid JSON record: Expected a value (string, number, object, array, true, false or null) but found 'e' (line 4, column 17): the value error on line 4 is missing its quotes. The conversion stops at the first bad record rather than silently dropping it, so the array you copy is always complete.

Input rules

  • Blank lines are skipped, including a trailing newline at the end of the file.
  • Windows line endings (CRLF) are handled like Unix ones.
  • Any JSON value can be a record. Lines holding numbers, strings or null are accepted and become array elements, not only objects.
  • A JSON array is accepted too. If you paste a whole array by mistake, it is formatted as-is and the status bar notes that the input was already a JSON array.
  • Each record must fit on one line. A pretty-printed object spread over several lines is not JSON Lines, and its first line is reported as an unfinished record.

Where JSONL files come from

You will meet JSON Lines in log files written by structured loggers, in exports from databases and data warehouses, in the result files of batch APIs and in machine learning datasets. mongoexport writes one document per line by default, for example. All of them can be pasted or uploaded here as they are.

Records do not need to share the same shape. The sample log on this page has a port field in one record and a retry flag in another; the array keeps every record exactly as written, without adding missing keys or reordering anything.

After converting

A formatted array is easier to inspect, but for thousands of records the JSON viewer with its collapsible tree is more comfortable. To pull specific fields out of every record, query the array with the JSONPath tester, for example $[*].msg. For spreadsheet work, convert the array onward with JSON to CSV.

The JSON → JSONL button on the same page reverses the process, writing each element of an array back onto its own line.

Privacy

Log files and dataset exports often contain personal data. The conversion runs entirely in your browser; nothing is uploaded unless you use Load URL, which fetches through our server, or Save & Share, which stores the input to create a link.

Frequently asked questions

How do I open a JSONL file?
A .jsonl file is plain text, so any text editor opens it. To read it as structured data, upload it here and convert it to a JSON array, which you can then browse in a JSON viewer.
Why does conversion fail on a pretty-printed file?
JSON Lines requires each record on a single line. A formatted object spread over several lines is one JSON document, not JSON Lines. If it is an array, paste it as-is; if it is a single object, format it with a JSON formatter instead.
Are blank lines a problem?
No. Empty and whitespace-only lines are ignored, including the newline at the end of the file. Line numbers in error messages still count them, so they match your editor.
Can I convert NDJSON with this tool?
Yes. NDJSON and JSON Lines are the same format, one JSON value per line, so .ndjson files convert the same way.

Last updated October 3, 2026

Related tools

JSON to JSONL Converter Convert a JSON array to JSON Lines (JSONL / NDJSON), one record per line, for streaming, logging, BigQuery and ML datasets. JSONPath Tester Test JSONPath expressions online against your JSON. Supports filters, wildcards, recursive descent and slices, returning values or paths. String to JSON Converter Convert an escaped JSON string back into formatted JSON. Handles quoted literals, backslash-escaped text and double-encoded JSON. JSON Graph Visualizer Visualize JSON data as a graph of connected nodes. See objects, arrays and values as a diagram of linked boxes with size badges. jq Playground Run jq filters on JSON in your browser with real jq 1.8: live output, -r -c -s -n -S and --arg options, clear errors and a clickable cheat sheet. JSON Cleaner Clean JSON by removing null values, empty strings, empty arrays and empty objects at any depth. Optionally trim whitespace in strings. JSON Decode Online Decode JSON strings online. Convert escaped or encoded JSON text into readable, formatted JSON, similar to json_decode. JSON Deserialize Online Deserialize an escaped JSON payload into formatted JSON, then map it to typed objects in JavaScript, Python, Java or C# safely. JSON Editor Edit JSON online with a live tree preview, instant validation and one-click formatting, repair and minification. JSON Encode Online JSON encode text or a document into an escaped string, with each escaping rule explained and the json_encode flags that give identical output. JSON Fixer & Repair Fix broken JSON automatically: add missing quotes, commas and brackets, remove comments and trailing commas, and convert Python literals. JSON Flatten Flatten nested JSON into single-level key paths like user.address.city, with dot, custom or bracket notation for arrays.