JSON to JSON Lines Converter

Converts a top-level JSON array into JSON Lines format, one item per line, each written as compact JSON, the newline-delimited format used for log files, streaming pipelines, and bulk-import APIs. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-24

Overview

Introduction

Log pipelines, bulk-import APIs, and streaming data tools generally expect JSON Lines rather than a single JSON array, since JSONL can be read, written, and appended one line at a time without ever parsing a whole file into memory.

This tool converts a JSON array you already have into that one-line-per-record format.

What Is JSON to JSON Lines Converter?

A converter that validates the input JSON, requires a top-level array, and writes each item out as its own line of compact JSON, joined with plain newlines.

The output has no surrounding brackets or commas between items, each line stands alone as a complete, independently parseable JSON value.

How JSON to JSON Lines Converter Works

The tool parses the input as JSON and checks that the result is an array; if it isn't, it fails with a message explaining that JSON Lines output requires a top-level array.

Each array element is passed through JSON.stringify individually (no indentation) and the results are joined with a single newline character between them, with no trailing blank line.

When To Use JSON to JSON Lines Converter

Use it to prepare a JSON array of records for a bulk-import endpoint, log aggregator, or streaming pipeline that expects JSON Lines.

It's also useful for converting a small JSON dataset into a form that's easy to grep, tail, or process line-by-line with standard Unix tools.

Features

Advantages

  • Produces standard, compact JSON Lines output with exactly one record per line and no trailing blank line.
  • Preserves any JSON value type per line, not just objects, matching the JSON Lines spec's flexibility.
  • Gives a clear, specific error when the input isn't a top-level array rather than guessing at intent.

Limitations

  • Only converts a top-level JSON array; there's no option to convert an object's values or a nested array without first restructuring the input.
  • Very large arrays are processed entirely client-side, so extremely large inputs are bounded by browser memory.

Examples

Array of objects to JSON Lines

Input

[{"a":1},{"b":2}]

Output

{"a":1}
{"b":2}

Each array item becomes its own compact-JSON line, with no enclosing brackets or separating commas.

Non-array input is rejected

Input

{"a":1}

Output

JSON Lines output requires a JSON array at the top level.

A bare JSON object has no natural line-by-line split, so the tool reports the requirement instead of guessing.

Best Practices & Notes

Best Practices

  • Wrap a single object in an array ([ {...} ]) first if you want to convert just one record to JSONL.
  • Use JSON Lines to JSON afterward to confirm a conversion round-trips back to the exact array you started with.
  • Keep individual records reasonably small if the target system reads JSONL line-by-line with a fixed buffer size.

Developer Notes

Each line is produced with a bare JSON.stringify(item) call rather than routed through a shared pretty-printer, since JSON Lines' one-line-per-record convention specifically calls for compact, whitespace-free output on every line, not the indented formatting used elsewhere on this site.

JSON to JSON Lines Converter Use Cases

  • Preparing a JSON array for a bulk-import API that expects JSON Lines
  • Converting sample data into a format that's easy to process with line-oriented Unix tools
  • Producing test fixtures for a log pipeline or streaming ingestion service

Common Mistakes

  • Passing a top-level JSON object instead of an array and expecting its properties to become lines.
  • Assuming the output is pretty-printed; each line is intentionally compact JSON, not indented.
  • Forgetting that a trailing newline isn't added after the last line, some tools expect one and may need it appended separately.

Tips

  • If your data starts as a single object per file, collect them into an array first before converting.
  • Use JSON Lines to JSON to validate a JSONL file you didn't generate yourself before trusting its structure.

References

Frequently Asked Questions