Skip to content
XUtilHub

JSON to JSON Lines (JSONL / NDJSON)

Convert a JSON array to JSON Lines (JSONL/NDJSON), one object per line, or convert JSONL back to a JSON array.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Input
Output

About the JSON to JSON Lines

Convert a JSON array to JSON Lines (one compact object per line), the format used by BigQuery, log pipelines and ML datasets. It also converts back.

Key features

  • JSON array → JSON Lines (one object per line)
  • JSON Lines → JSON array
  • Reports the exact line number of invalid records
  • Skips blank lines when reading JSONL
  • Compatible with NDJSON and JSONL tools
  • Download as a .jsonl file

What is JSON Lines?

JSON Lines (JSONL, also called NDJSON) stores one JSON value per line:

{"id":1,"name":"Laptop"}
{"id":2,"name":"Mouse"}
{"id":3,"name":"Desk Lamp"}

A regular JSON array of the same data:

[
  { "id": 1, "name": "Laptop" },
  { "id": 2, "name": "Mouse" },
  { "id": 3, "name": "Desk Lamp" }
]

This tool converts between the two in either direction.

Why JSON Lines?

JSON arrayJSON Lines
Streamable❌ must read the whole file✅ line by line
Append a record❌ rewrite the closing ]✅ append a line
Huge files (GBs)❌ memory-heavy✅ constant memory
Partial corruption❌ whole file invalid✅ only one line lost
Parallel processing⚠️ hard✅ split by lines

Where JSON Lines is used

  • Machine learning: OpenAI fine-tuning and batch files, Hugging Face datasets.
  • Data warehouses: BigQuery, Snowflake, Redshift and DuckDB loads.
  • Search: Elasticsearch/OpenSearch _bulk requests.
  • Logging: structured logs, one event per line.
  • Command line: jq -c '.[]' turns an array into JSONL.

Example: preparing a fine-tuning file

[
  { "messages": [ { "role": "user", "content": "Hi" }, { "role": "assistant", "content": "Hello!" } ] }
]

Convert to JSONL and each conversation becomes one line, exactly the format fine-tuning APIs expect.

To compact a single document, use JSON to One Line. To check an individual record, paste it into the JSON Validator.

How to use the JSON to JSON Lines

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The JSON Lines appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

Are JSONL and NDJSON the same?

Practically yes. Both mean newline-delimited JSON: one complete JSON value per line, separated by \n. The extensions .jsonl and .ndjson are interchangeable.

Why not just use a JSON array?

A JSON array must be loaded completely before parsing. JSON Lines can be streamed and appended line by line, so it suits huge datasets, logs and append-only files.

Which tools use JSON Lines?

BigQuery, Snowflake, Elasticsearch's bulk API, OpenAI and other LLM fine-tuning and batch APIs, Hugging Face datasets, jq -c, Spark, DuckDB and most log pipelines.

What if one line is invalid?

When converting JSONL to an array, the tool stops and tells you which line number failed to parse.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools