NDJSON to JSON Array Converter
Paste your NDJSON lines to merge them into one JSON array.
Result
How it is calculated
The input is split into lines (Windows, Unix and old Mac line endings all work) and blank lines are ignored. Each remaining line is parsed on its own as one JSON value, and the parsed values are collected, in order, into one array, printed with four-space indentation and unescaped Unicode. The tool reports the number of lines converted and a valid flag. If any line is not valid JSON, no array is given: the NDJSON specification (3.2) says a parser should raise an error for such a line rather than pass over it, so the tool sets the flag to No and lists the line numbers that failed (the first 20), counting every line of the text, blank ones included. A line with the literal null is kept as null. Lines may hold objects, arrays, numbers or strings, and one line may not span several lines of text.
Worked example
Paste three lines: {"id":1,"name":"Ada"}, {"id":2,"name":"Linus"} and {"id":3,"name":"Grace"}. Each is a valid JSON object, so the tool puts them in a single array in the same order: an opening bracket, the three objects separated by commas, and a closing bracket. The line count shows 3 and the valid flag shows Yes. If the second line were damaged, say {"id":2,, the tool would give no array at all: the flag would be No and the error line would name line 2, so you can fix it and convert again.
Common mistakes
- Pasting a pretty-printed or multi-line object. Each record must sit entirely on one line, otherwise the individual lines are not valid JSON and are dropped.
- Hunting for the bad record by eye. The error line names the line numbers that did not parse; fix those and convert again.
- Pasting a JSON array that is already complete. It is read as a single line and comes back wrapped in a second array, giving
[[...]]. - Trailing commas between lines. NDJSON lines are not separated by commas; a line ending in a comma is invalid and is skipped.
- Using single quotes or unquoted keys, which are accepted by some tools but are not valid JSON and fail here.
Sources
- NDJSON - Newline delimited JSON, specification version 1.0.0 (3.2: a parser SHOULD raise an error for a line that is not valid JSON) — ndjson-spec (specification repository on GitHub)
About this calculator
NDJSON (Newline Delimited JSON, also called JSON Lines or .jsonl) stores one complete, self-contained JSON object per line instead of wrapping everything in a single top-level array. This format is popular for streaming and append-only data because a producer can write one record at a time without ever needing to rewrite the whole file, and a consumer can process it line by line without loading the entire dataset into memory.
Tools like Elasticsearch's bulk API, Fluentd and other log shippers, Spark and BigQuery data loaders, and many machine-learning dataset formats all emit or expect NDJSON. This converter parses each line as an independent JSON value and combines them into a single pretty-printed JSON array, which is the format most general-purpose JSON viewers, `jq` pipelines, and REST APIs expect when NDJSON isn't directly supported.
Was this helpful?
You can pick up to 3 reactions.
Comments
- Be the first to comment.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm's Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Note from the editors
A quick integrity check is built in: if any line fails to parse, the tool gives no array and names the failing line numbers instead of quietly leaving records out. Typical causes are a record wrapped over two lines or a stray trailing comma. Fix those at the source rather than in the output, since the tool repairs nothing. Where does your NDJSON come from: a database export, an API stream, or logs?