Free Online JSON to JSONL Converter

This tool takes a JSON array and writes each item as one line in a JSONL file. JSONL is the format used by OpenAI, Hugging Face, and most LLM fine-tuning pipelines. Runs in your browser, free.

JSON to JSONL

Download Sample Files to Practice

Why Use Our JSON to JSONL Converter?

Professional features for developers and data engineers

Perfect for Big Data Platforms

  • Google BigQuery - Direct import with bq load command
  • Elasticsearch - Bulk API compatible NDJSON format
  • Apache Spark - Native JSONL reading with spark.read.json()
  • Snowflake - Optimized for parallel data loading

Advanced Converter Features

  • Real-time conversion - See results as you type
  • Large file support - Handle multi-MB JSON arrays
  • Bidirectional conversion - Convert JSONL back to JSON
  • 100% secure - Client-side processing, no data upload

Before & After

Array to lines conversion

JSON Array
json
[
  {
    "id": 1,
    "name": "Alice",
    "role": "engineer",
    "active": true
  },
  {
    "id": 2,
    "name": "Bob",
    "role": "designer",
    "active": false
  },
  {
    "id": 3,
    "name": "Carol",
    "role": "manager",
    "active": true
  }
]
JSONL Output
json
{"id":1,"name":"Alice","role":"engineer","active":true}
{"id":2,"name":"Bob","role":"designer","active":false}
{"id":3,"name":"Carol","role":"manager","active":true}

How It Works

Four simple steps

1

Upload JSON

Drop your JSON file or paste text directly into the editor.

2

Parse Array

The parser identifies the top-level array for splitting.

3

Convert Lines

Each array element becomes a separate JSONL line.

4

Download JSONL

Get your line-delimited JSON file ready for streaming.

Programmatic Conversion

Python and jq

Pythonjson_to_jsonl.py
import json

# Read a JSON array file
with open("data.json", "r") as f:
    records = json.load(f)

# Write each object as a single JSONL line
with open("output.jsonl", "w") as f:
    for record in records:
        f.write(json.dumps(record, ensure_ascii=False) + "\n")

print(f"Converted {len(records)} records to JSONL")
Bash (jq)convert.sh
# Convert a JSON array to JSONL with jq
jq -c '.[]' data.json > output.jsonl

# Verify line count matches array length
wc -l output.jsonl

Use Cases

Where JSONL is required

BigQuery Ingestion

Google BigQuery requires JSONL for bulk data loading via bq load. Each line is parsed independently by distributed workers, enabling parallel ingestion of terabyte-scale datasets.

Log Streaming

Logging systems like Fluentd, Logstash, and AWS CloudWatch emit structured logs as JSONL. Converting API responses to JSONL lets you feed them directly into your log pipeline.

Elasticsearch Bulk API

The Elasticsearch _bulk endpoint expects NDJSON (identical to JSONL). Convert your JSON arrays to JSONL before indexing thousands of documents in a single HTTP request.

Spark Processing

Apache Spark reads JSONL natively with spark.read.json(). Each line becomes a Row in a DataFrame, enabling distributed processing across your cluster without custom parsers.

JSON vs JSONL Format Comparison

Understanding the differences

FeatureJSON ArrayJSONL/NDJSON
Structure[{...}, {...}, {...}]{...}\n{...}\n{...}
Streaming Support❌ Must load entire file✅ Process line by line
BigQuery Compatible❌ Requires preprocessing✅ Direct import ready
Elasticsearch Bulk API❌ Not supported✅ Native NDJSON format
Memory UsageHigh (entire array in memory)Low (process one line at a time)
Parallel Processing❌ Sequential parsing required✅ Each line independent

FAQ

Common questions

Related Articles

Recommended Reading

JSON to JSONL Converter Guide

Everything you need to know

When to Use JSON to JSONL Conversion

Converting JSON arrays to JSONL format is essential when working with modern data platforms and streaming systems. BigQuery data loading requires JSONL format for optimal performance, while Elasticsearch bulk operationsuse NDJSON (identical to JSONL) for indexing multiple documents efficiently.

Best Practices for JSONL Conversion

  • Validate your JSON before conversion to ensure clean JSONL output
  • Use minified output for production data pipelines to reduce file size
  • Test with sample data first when working with large datasets
  • Keep backups of original JSON files before batch conversion

Common JSON to JSONL Use Cases

Our free JSON to JSONL converter is perfect for data engineers preparing datasets for cloud platforms, developers working with streaming APIs, and analysts importing data into BigQuery or Elasticsearch. The online JSONL converter handles everything from small configuration files to large data exports.

Complete Guide

In-depth walkthrough

Why JSONL is better for large datasets and streaming

With standard JSON you have to load the whole file into memory before processing any of it. A 1GB JSON array needs 1GB of RAM just to parse. With JSONL you can process one line at a time, which is essential for files with millions of records.

Logging systems use JSONL because you can append new events without rewriting the whole file. With a JSON array, adding one new record means reading the entire file, parsing it, adding the record, and writing it all back. With JSONL, you just append a new line to the end.

LLM training datasets almost always use JSONL because each training example is one line. OpenAI fine-tuning, Hugging Face datasets, and most ML pipelines expect JSONL input. Each line is an independent training example that can be shuffled, batched, and processed in parallel.

If you are working with data that gets processed line-by-line (logs, training data, streaming APIs), JSONL is the right format. If you need to load everything at once for analysis, standard JSON arrays work fine.

How to use the output in Python, OpenAI, and Hugging Face

Python: with open('file.jsonl') as f: for line in f: record = json.loads(line). This reads one line at a time without loading the whole file into memory. Each line is a complete JSON object that you parse independently.

OpenAI fine-tuning: the API expects JSONL with specific keys like messages or prompt/completion. The tool produces valid JSONL format. You need to format your data with the right keys before converting. Example: each line should be {"messages": [{"role": "user", "content": "..."}]}.

Hugging Face datasets: load_dataset('json', data_files='file.jsonl') works directly. The datasets library reads JSONL natively and creates a Dataset object. Each line becomes one example in your dataset. No preprocessing needed.

BigQuery: bq load --source_format=NEWLINE_DELIMITED_JSON dataset.table file.jsonl. BigQuery calls it NEWLINE_DELIMITED_JSON but it is the same as JSONL. Each line is one row in your table.

The key pattern: one line equals one record. Every tool that processes JSONL follows this rule. Read line-by-line, parse each line as JSON, process the record, move to the next line.

What if your JSON isn't a top-level array

The tool expects a JSON array as input like [{...}, {...}]. If your JSON is a single object like {"name": "Alice"}, wrap it manually: [{"name": "Alice"}]. Then convert.

If your JSON is nested like {"users": [{...}, {...}], "meta": {...}}, extract the array you want first. Copy just the users array part and paste that into the converter. Or use the JSON Flattener tool to restructure it.

The converter splits the top-level array into lines. If your data is not an array at the top level, you need to extract or wrap it first. This is a one-time manual step before conversion.