ModernCalcs

JSONL Formatter

Format, minify, or validate newline-delimited JSON (JSONL / NDJSON). Each line must be a valid JSON value. Use JSONL for streaming data, log files, and large dataset exports.

JSONL Input

3 lines

Output

{
  "id": 1,
  "event": "user.created",
  "name": "Alice",
  "ts": "2024-01-15T10:00:00Z"
}
---
{
  "id": 2,
  "event": "order.placed",
  "amount": 99.99,
  "currency": "USD",
  "ts": "2024-01-15T10:05:00Z"
}
---
{
  "id": 3,
  "event": "payment.success",
  "orderId": "ord_abc123",
  "ts": "2024-01-15T10:05:02Z"
}

JSONL Formatter: Process Newline-Delimited JSON

JSONL (JSON Lines) is the go-to format for streaming data, AI training datasets, and log aggregation. Unlike a JSON array, each line in a JSONL file is an independent, self-contained JSON value — making it possible to process records one at a time without loading the entire file into memory.

Frequently Asked Questions

What is JSONL / NDJSON?

JSONL (JSON Lines) and NDJSON (Newline Delimited JSON) are the same format: one valid JSON value per line, separated by newlines. It is used for streaming data, log files, and large dataset exports because each line can be processed independently.

What is the difference between JSONL and regular JSON?

Regular JSON is a single value (object, array, string, etc.) and must be fully parsed before processing. JSONL is a series of independent JSON values, one per line, making it ideal for streaming — you can process line 1 while line 2 is still being received.

Where is JSONL commonly used?

JSONL is used in: OpenAI API fine-tuning datasets, log aggregation systems (Loki, Elasticsearch), data pipelines (Kafka consumers writing events), and export formats from BigQuery, Snowflake, and DuckDB.

What does the Validate mode do?

Validate mode parses each line and reports which lines are valid (✓) and which have errors (✗ with the error message). Useful for checking log files or datasets for corrupt lines before processing.

What does the separator line (---) mean in Pretty Print mode?

In Pretty Print mode, each formatted JSON object is separated by --- to make it visually clear where one record ends and the next begins, since pretty-printed JSON spans multiple lines.

What counts as a valid JSONL line?

Any valid JSON value: an object {}, an array [], a string, number, boolean, or null. Each must be on its own line. Blank lines are ignored.