I Help You

JSON Lines to Array

Convert NDJSON / JSON Lines (one object per line) to a JSON array. Free, and it runs entirely in your browser — nothing you enter is uploaded.

How to use the JSON Lines to Array

1. Paste your JSON Lines (NDJSON) — one valid JSON value per line — into the left panel.

2. The right panel instantly shows a proper JSON array containing all parsed values.

3. Click Copy to save the array for use in your application or database.

What is it?

JSON Lines (also known as NDJSON — Newline Delimited JSON) is a format where each line of a file is a separate, self-contained JSON value. It is widely used for log files, database exports, streaming APIs (like the OpenAI API), and big-data pipelines because lines can be processed one at a time without loading the entire file into memory.

When you need to process NDJSON data in a context that expects a regular JSON array (like pasting into Postman, a database client, or a visualization tool), this converter wraps all lines into a valid array. Blank lines and trailing whitespace are automatically ignored.

Example

JSON Lines (NDJSON) — one object per line
{"id":1,"name":"Alice"}
{"id":2,"name":"Bob"}
{"id":3,"name":"Carol"}
↓
JSON Array
[
  {"id":1,"name":"Alice"},
  {"id":2,"name":"Bob"},
  {"id":3,"name":"Carol"}
]

NDJSON is used by streaming APIs (like OpenAI) and big-data pipelines because it's easy to append.

Benefits

Convert NDJSON log files to a standard JSON array for analysis

Most logging systems output one JSON object per line — analytics and query tools expect a JSON array; convert in one step.

Parse streaming API responses that use JSON Lines format

AI streaming APIs and data pipelines often return NDJSON — convert to a standard array for post-processing and inspection.

Prepare NDJSON data for import into analytics platforms

BigQuery, Redshift, and most BI tools accept JSON arrays; convert JSON Lines output before loading.

Merge multiple NDJSON event streams into a single array

Combine log output from multiple sources into one unified JSON array for consolidated analysis.

Frequently asked questions

What is JSON Lines / NDJSON?

JSON Lines is a text format where each line is a complete, valid JSON value (usually an object). The format is newline-delimited, so you can append or stream records without modifying existing content — unlike a JSON array which requires opening and closing brackets around all records.

What happens with blank lines?

Blank lines and lines with only whitespace are automatically skipped. Only non-empty lines are parsed and included in the output array.

Can I convert a JSON array back to JSON Lines?

Not with this tool — it converts JSON Lines to an array. To go the other way (array to one-object-per-line), paste your array into the JSON Formatter and manually reformat, or write a quick script: array.map(o => JSON.stringify(o)).join('\n').