JSON Array Input
JSONL Output
Converted output will appear here.

JSON to JSONL Converter Online

Convert a JSON array into JSONL (newline-delimited JSON / NDJSON) format: one compact object per line. Download the result as a .jsonl file ready for OpenAI fine-tuning, Elasticsearch ingestion, Kafka streaming, BigQuery loading, or any data pipeline that requires line-delimited records.

Why tools require JSONL instead of a JSON array

A JSON array is a single document. To access record #5,000 in a 10,000-record JSON array, you must load and parse all 10,000 records into memory first. This is expensive for large datasets and impossible for streaming systems that process records as they arrive.

JSONL solves this by keeping each record as an independent line. A consumer reads line 1, parses it, processes it, discards it, and moves to line 2: without ever holding the entire dataset in memory. This is why OpenAI requires .jsonl for fine-tuning datasets, why Elasticsearch's bulk API uses newline-delimited format, and why Fluentd, Kafka consumers, and BigQuery ingest jobs all prefer JSONL. Convert your array here, and the file is immediately compatible with all of them.

Concrete example

JSON array input

[
  {"id": 1, "name": "Alice", "plan": "pro"},
  {"id": 2, "name": "Bob",   "plan": "free"},
  {"id": 3, "name": "Carol", "plan": "pro"}
]

JSONL output: one compact record per line

{"id":1,"name":"Alice","plan":"pro"}
{"id":2,"name":"Bob","plan":"free"}
{"id":3,"name":"Carol","plan":"pro"}

How to use

  1. Paste a JSON array ([ ]) into the input. Or click Sample to see an example.
  2. Click Convert → to serialize each element as a compact JSON string on its own line.
  3. Review the output: confirm the correct number of lines matches your array length.
  4. Click Download to save as output.jsonl, or copy the text.

Where JSONL is used

OpenAI Fine-Tuning
OpenAI requires a .jsonl file for fine-tuning datasets. Each line must be a JSON object like {"messages":[...]}: one training example per line.
Elasticsearch Bulk API
Bulk indexing uses newline-delimited format. The document lines in a bulk request are standard JSONL: one document per line.
BigQuery / Snowflake
BigQuery LOAD jobs accept newline-delimited JSON. Snowflake COPY INTO supports NDJSON. Convert your JSON array before uploading.
Apache Kafka / Flink
Kafka producers and Flink jobs that consume JSON topics expect one event per message: matching the JSONL line-per-record structure.

Why each line is compact, not pretty-printed

JSONL requires exactly one JSON value per line. A pretty-printed object spans multiple lines: invalid JSONL because a multi-line object cannot be parsed line-by-line. Compact (whitespace-removed) serialization is correct here, not a limitation. Tools that consume JSONL always parse each line with their own JSON parser, so indentation is irrelevant to them. Use the JSONL Viewer to expand individual lines into pretty-printed JSON for human inspection.

Privacy

Conversion runs entirely in your browser using native JSON.parse and JSON.stringify. Your data is never sent to any server. This matters when your JSON array contains user records, training data with personal information, or proprietary business data.

Frequently asked questions

Why does OpenAI fine-tuning require a .jsonl file and not a JSON array?

OpenAI's API processes fine-tuning examples line by line: it never needs to load the entire dataset at once. A JSONL file can be streamed record-by-record, which is efficient for datasets with thousands of examples. A JSON array would require the entire file to be parsed before the first record is processed.

Does the input have to be a JSON array of objects, or can elements be other types?

Each element can be any valid JSON value: object, nested array, string, or number. The converter serializes each element on its own line. For OpenAI fine-tuning, each element must be an object like {"messages":[...]}. For other use cases, any valid JSON value per line is accepted.

Why is the output compact (minified) instead of pretty-printed?

JSONL requires one JSON value per line. Pretty-printing with line breaks inside the JSON would span the object across multiple lines, making it invalid JSONL. Compact serialization on a single line is the correct format. Use the JSONL Viewer to expand individual lines for human reading.

What if my array has objects with inconsistent fields across records?

JSONL has no schema constraint. Each line is an independent JSON object: it does not need to match the schema of other lines. Objects with different fields on different lines produce valid JSONL.

Can I convert an array of 50,000 records in the browser?

Yes. JSON.parse and JSON.stringify are native browser functions optimized for exactly this. 50,000 small objects convert in under a second. Very large individual objects (with hundreds of deeply nested fields each) may take a few seconds.

How is JSONL different from a CSV export?

CSV flattens data to rows and columns: it cannot represent nested objects or arrays without workarounds. JSONL preserves full JSON structure, including nested objects and arrays. Use JSONL when records have variable schemas or nested data. Use CSV when the data is strictly tabular and needs to open in Excel.

How do I convert back from JSONL to a JSON array?

Use the JSONL to JSON converter (/jsonl-to-json). It parses each line and wraps all results into a standard JSON array.

Related tools