Skip to content

Data formats

JSONL vs JSON: differences and when to use each

Quick answer

JSON stores one document — often a single array holding every record. JSONL stores one record per line. Use JSON for small payloads and APIs; use JSONL for large datasets, logs and anything you stream, append to or split.

By SourceX Editorial · Updated

Side by side#

Side by side
JSONJSONL
StructureOne document, e.g. [ {...}, {...} ]One JSON value per line
ReadingUsually parsed wholeParsed line by line
AppendingRewrite the arrayAdd a line
One bad recordWhole file fails to parseOnly that line fails
Best forAPIs, config, small filesDatasets, logs, streaming, sharding

When JSON is the better choice#

When a program expects one object, when the data is small, or when records need to sit inside a larger structure with metadata.

When JSONL is the better choice#

When files are large, when you process records one at a time, when you append over time, or when you need to split data into training, validation and test sets.

Converting between them#

To turn a JSON array (or an array nested inside an object) into JSONL, use the JSON to JSONL converter. To go back, the JSONL to JSON converter wraps every line into one array. Both run in your browser.

Try it in your browser

Free tools. Your file is processed in this browser and not uploaded.

Frequently asked questions

Is JSONL smaller than JSON?

About the same: JSONL drops the outer brackets and commas but adds newlines. The real difference is how it can be processed, not size.

Can I open JSONL where JSON is expected?

Usually not directly, because the file is not one JSON document. Convert it to a JSON array first.

Sources

  1. JSON Lines specification (jsonlines.org)
  2. RFC 8259: The JSON data interchange format

Related

Tell us what your models need

Share scope, volume, language, format, timing and licensing requirements.

See if your company qualifies