Skip to main content

JSON Lines Merger

Merge several JSON Lines (JSONL/NDJSON) sources into one JSON array or one NDJSON stream. Combines a pasted blob with any number of uploaded files, expands sources that are already JSON arrays, drops duplicate records, tags each record with where it came from, and reports invalid lines instead of failing on them.

Input

One JSON value per line. A whole JSON array is accepted too and gets expanded.

Drop files or browse
One or more files · any type

Optional. Each file is merged after the pasted input, in the order shown — use the arrows to reorder.

Options

Keeps the first occurrence. Records match on value, regardless of key order.

Object records only — the value is the source name shown in the report.

On: bad lines are listed in the report and the rest still merge. Off: nothing merges until they're fixed.

Output

Merged output
 
Summary
MetricValue
No data yet
Invalid lines
SourceLineIssue
No data yet
Was this helpful?

Guides

What this tool does

JSON Lines — also written JSONL or NDJSON — stores one self-contained JSON value per line. It is what most log shippers, data exports and streaming APIs emit, and it is deliberately easy to append to. What it is not easy to do is combine: three days of exports are three files, and pasting them end to end gives you a text blob no JSON parser will accept.

This merger takes several JSON Lines sources at once and produces a single result — either one JSON array you can feed to a parser, or one clean JSONL stream you can keep appending to.

How to use it

  1. Paste your JSON Lines into the input box, one JSON value per line.
  2. Optionally drop in more files (.jsonl, .ndjson, or .json). They are merged after the pasted input, in the order shown — use the arrows to reorder them.
  3. Pick Merge into: a JSON array (with your choice of indentation) or JSON Lines.
  4. Copy or download the merged output.

Everything runs in your browser. Your files are never uploaded.

Settings

  • Remove duplicate records — drops repeated records, keeping the first occurrence. Two records match when their values match, regardless of the order their keys were written in, so {"a":1,"b":2} and {"b":2,"a":1} count as the same record.
  • Tag each record with a _source key — adds the source name (Pasted input, File 1, File 2, …) to every object record, so you can tell which export a row came from after the merge.
  • Sort object keys alphabetically — normalises key order across sources that were produced by different writers.
  • Skip invalid lines — on by default. Bad lines are listed in the report with their line numbers and the rest of the data still merges. Turn it off when you would rather fix the input than silently lose records: nothing is merged until the reported lines are valid.

Mixing JSON arrays and JSON Lines

A source whose whole body is a JSON array ([{...},{...}]) is expanded element by element rather than rejected. That means a one-off .json API dump merges with your .jsonl log files in the same run, with no conversion step in between.

What happens to blank lines?

They are skipped and counted in the summary. Trailing newlines at the end of a file — which almost every writer emits — are therefore harmless.

Can I split a merged file back apart?

Set Merge into to JSON Lines and the output is one record per line again. To validate, pretty-print or minify a single stream instead of combining several, use the NDJSON Formatter & Validator. If your records are all the same shape and you want a spreadsheet, JSON to CSV Converter takes the merged array.

jsonlndjsonjsonmergecombinejson-lines

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.