Skip to content
Developer tools · JSON

JSON to NDJSON Converter

Convert JSON to NDJSON (JSON Lines) and back — including multi-gigabyte and gzipped Firehose or CloudWatch files — and generate the Athena table for it.

Last updated · shared JSON engine: exact big numbers, repair, AWS-aware

Developer Tools
JSON to NDJSON
Converter

The most complete free JSON ↔ NDJSON converter. Convert any JSON array or object into Newline Delimited JSON instantly — with syntax highlighting, live stats, advanced options, line inspector, and one-click download.

Converts JSON arrays → one object per NDJSON line Supports nested objects, mixed arrays, single objects Reverse mode: NDJSON → back to JSON array Sort keys, filter nulls, add _line & _ts metadata Download as .ndjson / .jsonl / .ldjson — 100% in-browser Validate every NDJSON line individually + Diff view Multi-GB & .gz files streamed — Firehose and CloudWatch Logs exports Athena CREATE TABLE generator, field summary, filter & CSV export
// Conversion Summary
JSON ↔ NDJSON Converter
Output options
Wrap mode
Download as
Input JSON 0 chars
Samples:
NDJSON Output 0 chars
NDJSON output will appear here…
Each line is a valid, standalone JSON object
⚠ Parse Error
Message
Position
Context
Fix hint
NDJSON Format Reference
PropertyValue
MIME typeapplication/x-ndjson
Extensions.ndjson  .jsonl  .ldjson
DelimiterNewline \n (LF, 0x0A)
Each lineValid, complete JSON value
Blank linesAllowed and ignored by parsers
EncodingUTF-8 (required per RFC 8259)
StreamableYes — process one line at a time
AppendableYes — just write a new line to the file
Who Uses NDJSON?
SystemWhy NDJSON / JSONL
ElasticsearchBulk API requires NDJSON format
Google BigQueryJSONL streaming inserts & exports
Apache KafkaCompact, streaming-friendly records
MongoDBmongoimport uses JSONL natively
AWS KinesisJSON-per-record data streams
Apache SparkBuilt-in JSONL reader/writer
jq / grep / awkProcess each record independently
Log pipelinesAppend one line per log event
Command-Line Conversion Reference
ToolJSON → NDJSON commandNotes
jqjq -c '.[]' input.json > out.ndjsonCompact (-c) each array element
Pythonpython3 -c "import sys,json;[print(json.dumps(r)) for r in json.load(sys.stdin)]" < in.jsonWorks on any OS
Node.jsnode -e "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).forEach(r=>console.log(JSON.stringify(r)))"Stream-friendly
PHP 8+array_map(fn($r)=>print(json_encode($r)."\n"), json_decode(file_get_contents('in.json'),true));One-liner CLI
NDJSON→JSONjq -s '.' input.ndjson > output.jsonSlurp all lines into array
Elasticsearchcurl -X POST "es:9200/_bulk" -H 'Content-Type: application/x-ndjson' --data-binary @data.ndjsonBulk ingest API

What Is NDJSON and Why Does It Matter?

NDJSON — Newline Delimited JSON — is a text format where every line is a standalone, valid JSON value. Unlike standard JSON arrays that must be fully downloaded and parsed before any record is accessible, NDJSON allows you to process data line by line, enabling true streaming, constant-memory processing, and effortless file appending.

NDJSON vs Standard JSON: Key Differences

Standard JSON stores records inside a single top-level array, requiring the entire document to be loaded into memory at once. NDJSON gives each record its own line, so systems can begin processing the first record while the rest of the file is still being downloaded or generated.

  • Streaming: Read and process records one line at a time — no full file load required.
  • Appending: Adding new records is as simple as writing a new line — no restructuring needed.
  • Partial reads: grep, awk, and jq can filter specific records without reading the whole file.
  • Compression: NDJSON gzips extremely well due to repeated key patterns across lines.
  • Error isolation: A corrupted line affects only that record, not the entire dataset.

NDJSON vs JSONL vs LDJSON

All three names refer to the exact same format: one complete JSON value per line. .ndjson is common in Node.js and Elasticsearch communities. .jsonl (JSON Lines) is preferred by Google BigQuery, Python's jsonlines library, and Apache Spark. .ldjson (Line Delimited JSON) appears in some older data pipelines. Choose the extension your target system expects — the content is identical.

When Should You Convert JSON to NDJSON?

  • Preparing data for Elasticsearch Bulk API indexing
  • Uploading records to Google BigQuery via streaming inserts or batch JSONL load jobs
  • Feeding records into Apache Kafka or AWS Kinesis topics
  • Importing data into MongoDB using mongoimport --type json
  • Processing large datasets with jq, Python, or Apache Spark
  • Building log ingestion pipelines where each event is appended as a new line
  • Querying S3 data with Amazon Athena or AWS Glue — the OpenX JSON SerDe needs one object per line
  • Reading Amazon Data Firehose output, which writes records back to back ({…}{…}) unless you add a newline delimiter

Is This Tool Private and Free?

Yes — completely. All JSON to NDJSON conversion logic runs entirely in your browser using JavaScript. No data is ever sent to any server. You can safely convert confidential payloads, API responses, and production data without any privacy concern. The tool also works offline once the page is loaded.

Frequently Asked Questions

What is NDJSON?
NDJSON (Newline Delimited JSON) is a text format where each line is a complete, valid JSON value. It is widely used in data pipelines, streaming systems, and log processing because each record can be read independently.
What is the difference between NDJSON and JSONL?
They are the same format. JSONL (JSON Lines) is the name used by BigQuery and Python libraries; NDJSON is preferred in the Node.js and Elasticsearch ecosystems. File content is identical.
Can I convert a single JSON object to NDJSON?
Yes. A single JSON object outputs as one NDJSON line. A JSON array produces one line per element. Use "Wrap object in array" mode to force a single object into a one-element array output.
How do I convert NDJSON back to JSON?
Use the "NDJSON → JSON" toggle. Paste your NDJSON and click Convert — all lines are wrapped into a valid JSON array. With jq: jq -s '.' file.ndjson
Does Elasticsearch require NDJSON?
Yes — the Elasticsearch Bulk API requires NDJSON. Each document must be preceded by an action metadata line. This tool generates the document lines; you pair them with action metadata.
Is my data sent to your servers?
No. Everything runs in your browser. Nothing is transmitted. The tool is fully private and also works offline after the page has loaded.
Can it convert very large or gzipped files?
Yes. Convert a large file reads the file in pieces, so multi-gigabyte JSON, NDJSON and .gz files (such as Amazon Data Firehose or CloudWatch Logs exports) convert without loading everything into memory. It can expand CloudWatch log events, split the output into parts and gzip it.
How do I query NDJSON with Amazon Athena?
Store one JSON object per line in S3 and create an external table with the OpenX JSON SerDe. The Fields & Athena table tab summarises your fields, flags type conflicts and writes the CREATE EXTERNAL TABLE statement, including mappings for reserved words such as timestamp.
Practical guide

NDJSON for AWS data pipelines

NDJSON (also called JSON Lines) puts one JSON value on each line. Many AWS tools expect it:

  • Amazon Athena and AWS Glue read it with the OpenX JSON SerDe, which needs each record on a single line.
  • Amazon Data Firehose writes records to S3 back to back ({…}{…}) unless you add a newline delimiter.
  • Bedrock batch inference and many bulk APIs take JSONL input files.

Small inputs: the converter above

Paste a JSON array, a single object, NDJSON, or concatenated JSON. The converter splits records, keeps big numbers exact, and reports invalid NDJSON lines with their real line numbers.

Large files: Convert a large file

The file is read in pieces, so it is never loaded into memory all at once. This lets the browser convert files of several gigabytes.

  • Inputs: JSON arrays, NDJSON, concatenated JSON and .gz files. Gzip is detected from the file content, not the name.
  • Validate every record: bad records are skipped and listed with the line where they start, instead of stopping the whole conversion.
  • Expand CloudWatch Logs payloads: subscription data delivered through Firehose holds many log events per record. This writes one line per event, with logGroup and logStream added, and drops control messages.
  • Parse JSON inside message fields: turns a "message": "{\"level\":\"ERROR\"…}" string into a real object, so Athena can query its fields.
  • Split and gzip: split the output every N MB or N records, and gzip each part. Athena reads .gz files directly.

Create the Athena table

Fields & Athena table works on the input box or on the first 5,000 records of the last converted file. It shows:

  • every field, how often it appears, and its types;
  • fields whose type differs between records (these break queries);
  • keys that differ only by case (Athena lowercases column names).

It then writes a CREATE EXTERNAL TABLE statement for the OpenX JSON SerDe:

  • numbers become bigint or double;
  • objects become struct<…> and arrays array<…>;
  • reserved words such as timestamp and keys with special characters are renamed and mapped back with "mapping.…" properties;
  • "ignore.malformed.json" = "TRUE" is set so one bad line doesn't fail the query.

Filter and CSV

Keep only the records you need, with conditions such as level = ERROR, status >= 500, message ~ timeout or userId exists. Copy the result as NDJSON, or download a CSV. Nested fields become a.b columns, and formula characters are escaped so spreadsheets don't run them.

Official references

Runs 100% in your browser. Your files and data never leave your machine. Nothing is uploaded or stored.

Need a hand with your AWS setup?

Get help from an AWS architect who builds and runs contact centre and AI workloads: IAM, data pipelines, Bedrock and cost reviews.