Convert JSONL to JSON Online

Turn JSON Lines or NDJSON into one valid JSON array. Paste data or upload a file, catch malformed lines, preview the result, and download it without uploading your data.

Private browser conversion

One valid JSON value per line

Up to 15.00 MB

Valid standard JSON

Converted JSON will appear here automatically.

Want to test drive the tool?

Before & After Example

JSONL Input (one object per line)
json
{"id": 1, "name": "Alice", "role": "admin"}
{"id": 2, "name": "Bob", "role": "editor"}
{"id": 3, "name": "Carol", "role": "viewer"}
JSON Array Output
json
[
  {
    "id": 1,
    "name": "Alice",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Bob",
    "role": "editor"
  },
  {
    "id": 3,
    "name": "Carol",
    "role": "viewer"
  }
]

Format Comparison

Data format comparison for common interchange scenarios (JSONL and NDJSON are the same format under two names)
FeatureJSONL / NDJSONJSONCSV
StructureOne JSON value per lineSingle root array/objectHeader row + data rows
StreamingYes - line by lineNo - standard parsers read the whole documentYes - row by row
Nested DataSupported per lineFully supportedNot supported
File Extension.jsonl or .ndjson.json.csv
Common UseLogs, ML datasets, BigQuery exports, Elasticsearch bulkAPIs, web apps, configsSpreadsheets, databases
Human ReadableModerateGood (when formatted)Excellent
Append-FriendlyYes - just add linesNo - must rewrite arrayYes - just add rows

How It Works

1

Load JSON Lines

Paste or upload a .jsonl or .ndjson file (up to 15 MB) with one JSON value per line.

2

Validate Lines

Each line is parsed individually to ensure valid JSON syntax.

3

Reconstruct Array

Objects are wrapped in array brackets with proper commas.

4

Download JSON

Copy or download the .json file, pretty-printed or minified.

Frequently Asked Questions

Code Examples

How to Convert JSONL to JSON in Python

Converting JSONL to JSON in Python is simple using the built-in json module. Read each line from the JSONL file, parse it with json.loads(), and write it straight to the output file with commas between records and brackets around the whole thing. Because no list of records is built up, memory use stays flat even for multi-gigabyte files. Perfect for converting streaming data, log files, or machine learning datasets into standard JSON format for analysis or API consumption.

Pythonjsonl_to_json.py
import json

# Stream JSONL to a JSON array: each record is written as soon as it is read,
# so memory use stays flat no matter how big the file is.
count = 0
with open("data.jsonl", encoding="utf-8") as src, open("output.json", "w", encoding="utf-8") as dst:
    dst.write("[")
    for line in src:
        line = line.strip()
        if not line:
            continue  # skip blank lines
        record = json.loads(line)  # raises on a malformed line
        dst.write(",\n  " if count else "\n  ")
        dst.write(json.dumps(record, ensure_ascii=False))
        count += 1
    dst.write("\n]\n" if count else "]\n")

print(f"Converted {count} JSONL lines to JSON array")

How to Convert JSONL to JSON in Node.js

Converting JSONL to JSON in Node.js uses the fs module and readline for efficient line-by-line processing. Read the JSONL file, parse each line with JSON.parse(), and write each record to a write stream with JSON.stringify() as soon as it is read. Because records are never collected into one big array, this handles large files without loading everything into memory. Ideal for backend services, data transformation pipelines, or converting API responses from JSONL format to standard JSON arrays.

Node.jsjsonl-to-json.js
const fs = require("fs");
const readline = require("readline");
const { once } = require("events");

// Stream JSONL to a JSON array without holding every record in memory
async function jsonlToJson(inputPath, outputPath) {
  const rl = readline.createInterface({
    input: fs.createReadStream(inputPath),
    crlfDelay: Infinity,
  });
  const out = fs.createWriteStream(outputPath);
  const write = async (chunk) => {
    if (!out.write(chunk)) await once(out, "drain"); // respect backpressure
  };

  let count = 0;
  await write("[");
  for await (const line of rl) {
    if (!line.trim()) continue;
    const record = JSON.parse(line); // throws on a malformed line
    await write((count ? ",\n  " : "\n  ") + JSON.stringify(record));
    count++;
  }
  await write(count ? "\n]\n" : "]\n");
  out.end();
  await once(out, "finish");
  console.log(`Converted ${count} lines to JSON array`);
}

jsonlToJson("data.jsonl", "output.json");

Complete Conversion Guide

Why JSONL exists and when you'd convert it

JSONL is better for streaming because you can read one line at a time without loading the whole file into memory. This makes it perfect for processing logs, large datasets, or real-time data feeds where you process records as they arrive.

Standard JSON arrays are better for tools that expect a JSON array input, like most data analysis tools, Pandas, and REST APIs. They need the data wrapped in brackets with commas between objects.

Convert when your downstream tool doesn't support JSONL natively. If you're loading data into a web app, sending it to an API, or importing into a tool that expects standard JSON, you need to convert from JSONL to a JSON array first.

Most conversions happen because the next step in your workflow expects standard JSON format, not line-delimited records.

What to do if a line fails to parse

If one line is malformed (missing bracket, trailing comma, unquoted key), most converters either fail entirely or silently drop that line. This is the #1 problem users hit when converting JSONL files. This tool lists every failing line with its line number and the parser error, and holds back the output until the lines are fixed.

How to find it: paste or upload the file here and read the error list, which names each bad line. Don't rely on VS Code's built-in JSON validator for .jsonl files: it treats the whole file as one JSON document, so it flags every line after the first even when each line is fine.

Or run jq -c . yourfile.jsonl in the terminal. jq stops at the first parse error and reports its line and column, so fix that line and run it again to find the next one.

Fix the malformed line and the output appears automatically. If you just want the good records, turn off Validate lines in Conversion settings: invalid lines are skipped and a notice tells you how many were dropped.

Need an editor for JSONL or converted JSON?

After converting JSONL to a JSON array, open the result in an editor that handles validation and large nested files well.

File size and large JSONL files

The tool runs in the browser so there's no server upload. Your data stays on your machine, which is great for privacy but means the whole file has to fit in browser memory. To keep the page responsive, this converter accepts JSONL input up to 15 MB; larger uploads are rejected with a message.

For files over 15 MB, split them first or convert locally. The quick Python one-liner is: python3 -c "import json; print(json.dumps([json.loads(l) for l in open('file.jsonl') if l.strip()]))" > output.json

That one-liner builds the whole list in memory, so it needs RAM roughly proportional to the file size. For files bigger than your available memory, use the streaming Python or Node.js script in the code examples above: they write each record to the output as soon as it is read, so memory use stays flat.

Related JSON Guides