# JSONL

> JSON Lines: a text format with one complete JSON object per line, used for large datasets and streaming results.

JSONL, also called JSON Lines or newline-delimited JSON, stores records as a sequence of JSON objects separated by newlines. Each line is a valid JSON document on its own. There is no surrounding array, no commas between records and no closing bracket to wait for, so a program can read and process the file one line at a time.

That property is what makes the format popular for big jobs. A ten-million-row export in a single JSON array has to be parsed as one huge document, which strains memory. The same data as JSONL can be streamed, split into chunks, appended to and loaded in parallel. Many data warehouses, log pipelines and machine learning tools accept it directly.

Compared with CSV, JSONL keeps nested structure and types. A person record with a list of past jobs or a phone object stays intact instead of being flattened into awkward columns. The tradeoff is size and readability in a spreadsheet, where CSV is usually more convenient.

## How Dizo handles it
Batch jobs (`POST /v1/batch`, up to 10,000 lookups) return results as JSONL or CSV via the `format` parameter. `GET /v1/batch/{id}` gives a `results_url` to the file, available for 7 days. Enterprise bulk delivery also offers JSONL, alongside CSV and Parquet, to cloud storage or a warehouse.

Docs: [/docs/batch](https://dizo.ai/docs/batch.md), [/docs/batch-get](https://dizo.ai/docs/batch-get.md), [/docs/webhooks](https://dizo.ai/docs/webhooks.md)

Related terms: [Webhook](https://dizo.ai/glossary/webhook.md), [OpenAPI spec](https://dizo.ai/glossary/openapi-spec.md), [Data enrichment](https://dizo.ai/glossary/data-enrichment.md), [Rate limit](https://dizo.ai/glossary/rate-limit.md)


## What JSONL is

JSONL is short for JSON Lines, a simple text format where each line of a file is one complete JSON value, almost always an object. Lines are separated by a newline character. You will also see it called newline-delimited JSON or NDJSON, and files often use the `.jsonl` or `.ndjson` extension. A two-record file looks like `{"id":1,"status":"found"}` on the first line and `{"id":2,"status":"not_found"}` on the second.

The important difference from ordinary JSON is the lack of a wrapper. A regular JSON export of many records is one array: an opening bracket, records separated by commas, and a closing bracket at the very end. To read any of it reliably, a parser usually loads the whole thing. JSONL has no wrapper at all, so every line can be parsed independently.

The rules are short. Each line must be valid JSON, lines are separated by newlines, the file is UTF-8 text, and a JSON value must not contain a raw newline inside it. Pretty-printed JSON with indentation over several lines is therefore not valid JSONL.

## Why JSONL matters for GTM data and AI agents

GTM data jobs are often large. Enriching a CRM, verifying a list or exporting a market segment can mean tens of thousands of records. JSONL lets you process those results as a stream: read a line, write the record to your database, move on. Memory use stays flat whether the file holds a hundred records or ten million.

It also keeps structure that CSV loses. Contact data is nested by nature. A person has a location object, a company object, a list of past roles and possibly several phone numbers, each with a type and a flag. JSONL keeps that shape intact, so the code that reads results can use the same field names as the API response instead of decoding flattened columns.

For AI agents, JSONL is a practical bridge between bulk jobs and reasoning. An agent can read a results file in chunks, summarize hit rates, pick the records that need follow-up and write the rest straight to storage, without ever loading a giant array into its context window.

## How to read and write JSONL

Reading JSONL is the same in almost every language: open the file, loop over lines, skip empty lines, and parse each one as JSON. Because each line stands alone, a single malformed line affects only that record. Good readers log the line number of any parse error and continue rather than abandoning the whole file.

Writing is just as simple. Serialize each record as compact JSON with no indentation, write it, then write a newline. Appending new records is a matter of writing more lines to the end, which is why JSONL is common for logs and incremental exports.

Typical places you will meet JSONL in a data stack:

- Results files from asynchronous batch APIs.
- Bulk loads into data warehouses and lakes.
- Application and event logs, one event per line.
- Training and evaluation datasets for machine learning.
- Streaming HTTP responses where each line is one update.

## Common mistakes and misconceptions

The most common mistake is writing pretty-printed JSON and calling it JSONL. If a record spans several lines, a line-by-line reader will try to parse fragments and fail. Always serialize compactly. The second most common mistake is wrapping the file in brackets or adding commas between lines, which turns it back into something that is neither valid JSON nor valid JSONL.

Another misconception is that JSONL must be loaded into memory like JSON. The whole point is that it does not. If your code reads the entire file and splits it afterwards, you lose the main benefit. Stream it.

Finally, do not assume every line has the same fields. Records from a lookup job may differ: a found record has data, a miss may carry only the input and a status. Code defensively for optional fields, and check the provider's docs for the exact line shape.

## JSONL versus CSV and Parquet

CSV is the easiest format for humans. It opens in any spreadsheet and every tool can import it. But it flattens nested data, has no types, and breaks easily on commas, quotes and newlines inside values. For a quick review of a list by a sales manager, CSV is usually the right choice.

Parquet is a columnar binary format built for analytics. It compresses well and lets query engines read only the columns they need, which makes it efficient for very large warehouse tables. It is not human-readable and needs a library to open.

JSONL sits between them. It is text, so you can inspect it with a text editor or command-line tools, but it keeps nesting and types. It is a sensible default for machine-to-machine pipelines, especially when the next step is code rather than a spreadsheet.

## How JSONL shows up in Dizo

Dizo's [batch endpoint](/docs/batch), `POST /v1/batch`, runs up to 10,000 lookups in one asynchronous job against any lookup endpoint, such as email find or company enrich. Set `format` to `"jsonl"` or `"csv"` to choose the results file. Each item costs the same as the underlying endpoint, and misses are still free.

When the job finishes, Dizo sends a `batch.completed` webhook, or you can poll `GET /v1/batch/{id}` for free. The status response includes the job `status`, the number of `hits`, the `credits_used` and a `results_url` pointing to the file. Results stay available for 7 days, so download and store them promptly. The [batch jobs](/features/batch-jobs) page covers the workflow in more depth.

For larger needs, Dizo's enterprise bulk delivery sends full or filtered datasets as CSV, Parquet or JSONL to S3, GCS, Azure Blob, Snowflake or SFTP, refreshed monthly or weekly. That route is for data licensing rather than per-record lookups.

## Worked example: enriching a CRM export

A data engineer exports 8,000 company domains from the CRM. They split the list into one batch job against company enrich, with `format` set to `"jsonl"`, a `webhook_url` and `max_credits` of 8,000. Before running it, they send the same request with `"dry_run": true` to get a free quote, which confirms the job cannot exceed 8,000 credits.

When `batch.completed` arrives, the handler fetches the results file and streams it line by line. Matched lines are upserted into the warehouse by domain, and unmatched lines are written to a separate table for review. Memory use stays flat because no line depends on any other.

Suppose 6,900 companies match. Company enrich costs 1 credit if matched, so the job costs 6,900 credits. At the pay-as-you-go rate that is $172.50. If the team had bought credits in a single $2,000 purchase at the Growth rate of $0.017, the same job would cost $117.30. The 1,100 unmatched domains cost nothing.

## Validating and processing JSONL safely

Before loading a results file into a production system, run a quick validation pass. Count the lines, check that every line parses, and compare the count with the number of items you submitted. A mismatch usually means a truncated download, which is cheaper to catch before you write half a file into your CRM than after.

When processing, make each write idempotent. Use a stable key such as the input domain, email or person id to upsert records, so re-running the same file after a failure updates rows instead of duplicating them. Keep the raw file in storage alongside a note of when it was produced. If someone later questions a value, you can trace it back to the exact job and line that supplied it.

## Related concepts

JSONL usually arrives at the end of an asynchronous job, which is why it pairs with [webhooks](/glossary/webhook): the webhook says the file is ready, and the file holds the data. Rate limits are another reason to prefer batch jobs and JSONL results over thousands of single calls.

An [OpenAPI spec](/glossary/openapi-spec) describes the shape of each API response, which is also the shape you should expect for found records in a results file.

## FAQ

### Is JSONL the same as NDJSON?
In practice, yes. JSON Lines and newline-delimited JSON describe the same idea: one JSON value per line, separated by newlines. Files may use either the `.jsonl` or `.ndjson` extension.

### Can I open a JSONL file in a spreadsheet?
Not directly in most spreadsheets, because each line is a JSON object rather than a row of columns. Convert it first, or request CSV instead when the results are meant for people to review.

### Why not just use a JSON array?
A large JSON array usually has to be parsed as one document, which uses a lot of memory and fails entirely if one part is malformed. JSONL can be streamed line by line, appended to and split for parallel processing.

### Can a JSONL record span multiple lines?
No. Each record must be on a single line, so pretty-printed JSON is not valid JSONL. Serialize each record compactly before writing it.

### How do I get Dizo results as JSONL?
Set `format` to `"jsonl"` on a `POST /v1/batch` request. When the job completes, the batch status response includes a `results_url` for the file, which stays available for 7 days.

### When should I choose CSV over JSONL?
Choose CSV when people will open the file in a spreadsheet or import it into a tool that only accepts flat columns. Choose JSONL when code will process the results and you want to keep nested fields intact.
