CodeMash

JSON to JSONL Converter Online — Free

Convert a JSON array to JSONL (JSON Lines / NDJSON), one record per line — the format OpenAI and Anthropic fine-tuning requires.

Ad Space

Frequently Asked Questions

What is JSONL?

JSONL (also called JSON Lines or NDJSON) is a text format where every line is one complete, self-contained JSON value. There is no wrapping array and no commas between records, which makes the file streamable line by line.

Why does fine-tuning require JSONL instead of JSON?

A training file can be millions of examples. JSONL can be read one line at a time with constant memory, and a single malformed record only invalidates its own line rather than the whole file. A JSON array must be parsed in full before any record is available.

What happens to nested objects?

Nothing — each record is serialised compactly onto a single line, with nesting preserved exactly. Only the indentation is removed, because a record cannot span multiple lines.

Is my training data uploaded anywhere?

No. The conversion runs entirely in your browser, which matters when fine-tuning data contains proprietary or personal information.

Privacy First: All processing happens directly in your browser. Your data never leaves your device.

About JSON → JSONL

JSONL — one complete JSON value per line, with no wrapping array and no commas between records — is the format LLM fine-tuning pipelines actually consume. Converting an array into it is mechanically simple, and getting the details wrong is what breaks uploads.

Why the line boundary is the whole format

The entire value of JSONL comes from one property: a record never spans more than one line. That is what lets a consumer read a hundred-million-line training file with constant memory, resume from a byte offset after a failure, and split a dataset across workers by simply counting newlines.

It follows that each record must be serialised compactly. Pretty-printed JSON cannot be used, because indentation puts a single record across many lines and destroys the property the format exists for. Conversion here always emits compact records for that reason.

An array becomes one record per line
[
  { "id": 1, "name": "Alice" },
  { "id": 2, "name": "Bob" }
]

{"id":1,"name":"Alice"}
{"id":2,"name":"Bob"}

The fine-tune chat shape

For supervised fine-tuning, both OpenAI and Anthropic expect each line to be one complete training example wrapped in a messages array. An example is a whole conversation, not a single turn — so a multi-turn dialogue stays on one line rather than being split across several.

The two providers differ in where the system prompt lives. OpenAI places it as the first element of the messages array with role "system". Anthropic takes it as a top-level "system" field alongside messages. A dataset built for one will not upload cleanly to the other without that adjustment.

Beyond fine-tuning

  • BigQuery, Redshift and Snowflake all load newline-delimited JSON natively; a single wrapped array is rejected by their loaders.
  • Structured application logs are conventionally JSONL, one event per line, so that tail and grep remain useful.
  • Batch inference APIs accept JSONL request files, one request per line, keyed by a custom id.
  • Streaming HTTP responses use the same convention, letting a client process each record as it arrives rather than waiting for the closing bracket.