Every line is checked
Each line is parsed as JSON. Invalid lines are reported with the file name, the line number and the parser message, and one bad file does not stop the others.
Merge JSONL and NDJSON files into one, with every line checked, duplicates removed and nothing uploaded.
or drag and drop .jsonl, .ndjson, .jl, .json or .txt files here
Each line is parsed as JSON. Invalid lines are reported with the file name, the line number and the parser message, and one bad file does not stop the others.
Drop exact duplicate records, or records that share a key such as id or user.email, and keep either the first or the last occurrence.
Valid lines are written with their original text by default, so large numbers, key order and spacing inside a record do not change.
Your original files stay unchanged; the merged file is a new download.
Choose or drop .jsonl, .ndjson, .jl, .json or .txt files, paste text, or try the sample files.
Each file shows its lines, valid records and invalid lines. Reorder with the arrows or by dragging.
Decide what happens to invalid lines, remove duplicates, sort, and pick JSONL or JSON array output.
The output is re-read and checked, then offered as a download with a preview and a report.
Merging regular JSON files that hold arrays or nested objects is a different job. Use the JSON merger for that, or read how to merge JSON files.
No. Your browser reads each file, checks every line, and builds the merged file on your device. There is no upload and no account, and nothing is kept after you close the page. That matters for logs, exports and training data that contain personal or internal information.
Not with Keep original text on, which is the default for JSONL output. Each valid line is copied as it was, minus surrounding spaces. If you add a source field, choose JSON array output or turn the option off, records are parsed and written again as compact JSON. The data stays the same with one exception: integers beyond JavaScript's safe range (above 9,007,199,254,740,991) can be rounded, and keys that are whole numbers move to the front of their object. The tool warns you when an input has an integer with more than 15 digits.
JSON Lines, written JSONL, is a text format with one JSON value per line. The rules on jsonlines.org are short: the file is UTF-8, each line is a complete JSON value as defined by RFC 8259, and lines end with a line feed. NDJSON, described in the NDJSON specification, is the same format under another name. The extensions .jsonl, .ndjson and .jl all mean the same thing.
The format is common wherever records arrive over time or files get large:
In each case you end up with many files that belong together, and at some point you need to merge the JSONL files into one. If you want to look at a file before or after merging, open it in the JSONL Viewer. If you need test data, the sample JSONL files page has twelve ready-made files, including one with duplicates and one with invalid lines. The sample JSON files page has JSON files that the JSON to JSONL converter turns into JSON Lines.
Because every line stands alone, you can merge JSONL files by writing one after another. There is no array to rebuild and no commas to fix. That only holds when each file is clean. These five problems cause most broken merges:
.json array. Its lines are fragments such as [ and {"id": 1},, and none of them is a record.The JSONL Merger handles all five. It treats the end of a file as the end of a line, removes byte order marks, accepts LF, CRLF and CR, converts a file that is one JSON array into one record per item, and ignores blank lines.
cat is the usual way to concatenate JSONL files. It copies bytes and checks nothing, so it is fast and works on files of any size. Use awk 1 when you are not sure that every file ends with a line break.
# Fine when every file ends with a line break
cat part1.jsonl part2.jsonl part3.jsonl > merged.jsonl
# Safer: awk adds the missing line break at the end of a file
awk 1 part1.jsonl part2.jsonl part3.jsonl > merged.jsonl
# Every .jsonl file in a folder, in name order.
# Write the result outside that folder so it is not read as input.
awk 1 logs/*.jsonl > merged.jsonlGet-Content reads lines, so a missing final line break is not a problem, and it drops a byte order mark while reading. Do not use the > redirect in Windows PowerShell 5.1: it writes UTF-16, which most JSONL readers cannot open.
# Reads line by line, drops blank lines, writes UTF-8.
# PowerShell 7 writes no byte order mark; Windows PowerShell 5.1 adds one.
Get-Content part1.jsonl, part2.jsonl, part3.jsonl -Encoding utf8 |
Where-Object { $_.Trim() } |
Set-Content merged.jsonl -Encoding utf8jq parses every record, so it validates while it merges, and -c writes each record on one line. It also fixes pretty-printed input. It has two limits. It stops at the first invalid line instead of skipping it. And the -s (slurp) option, which duplicate removal and sorting need, loads every record into memory. Versions before 1.7 also read numbers as 64-bit floats, so very large integers are rounded. The jq manual documents each option.
# Parse every record and write it back on one line
jq -c . part1.jsonl part2.jsonl > merged.jsonl
# Turn a JSON array file into JSONL before merging it
jq -c '.[]' export.json > export.jsonl
# Merge and keep one record for each id (output is sorted by id)
jq -c -s 'unique_by(.id)[]' part1.jsonl part2.jsonl > merged.jsonl
# Sort a merged file by a field
jq -c -s 'sort_by(.created_at)[]' merged.jsonl > sorted.jsonlA script is the right choice when you want to skip bad lines and keep going. This one reads the files line by line, so memory use stays low. It reports invalid lines with their line numbers, removes duplicate id values and writes the original text of each line. For more on reading JSON in Python, see how to parse JSON in Python.
import json
import sys
inputs = ["part1.jsonl", "part2.jsonl", "part3.jsonl"]
seen = set()
written = duplicates = skipped = 0
with open("merged.jsonl", "w", encoding="utf-8", newline="\n") as out:
for path in inputs:
# utf-8-sig drops a byte order mark if the file has one
with open(path, encoding="utf-8-sig") as src:
for line_no, line in enumerate(src, start=1):
line = line.strip()
if not line:
continue
try:
record = json.loads(line)
except json.JSONDecodeError as err:
print(f"{path}:{line_no}: {err}", file=sys.stderr)
skipped += 1
continue
key = record.get("id") if isinstance(record, dict) else None
if isinstance(key, (str, int)):
if key in seen:
duplicates += 1
continue
seen.add(key)
out.write(line + "\n") # the original text, unchanged
written += 1
print(f"{written} written, {duplicates} duplicates, {skipped} invalid", file=sys.stderr)The command line is enough when the files are clean and you only need them joined. The browser tool saves time when you want a per-file report of bad lines, duplicate removal by key, a source field on each record, or when you are on a computer where you cannot install jq or Python.
Duplicates appear when exports overlap (a daily file and a weekly file that cover the same day), when a job is retried and writes its output twice, or when the same file is added to a merge under two names. Whether to remove them depends on what a record means. Two identical log events can both be real. Two rows with the same user id usually are not.
{"a":1,"b":2} and {"b":2,"a":1} are the same record.id, custom_id, uuid or a nested path like user.email. Pick a key that is unique for each real-world item. A timestamp is rarely a good key.The number 1 and the text "1" are different key values, so ids stored as numbers in one file and as strings in another will not match. Records that lack the key are never removed.
File order is the right default for logs and time-ordered exports, as long as you list the files in order. Sort by key when the files overlap in time or when a later step expects ordered input, for example sorting by created_at or id. ISO 8601 timestamps such as 2026-03-14T09:30:00Z sort correctly as text. Numbers are compared as numbers, so 9 comes before 10. Records without the key are placed at the end, and records with equal keys keep their file order.
Before the download appears, the tool reads its own output again. For JSONL it parses every line and confirms that the line count equals the record count. For a JSON array it parses the whole text and checks the array length. You can run the same check yourself on any merged file:
# Count the records
wc -l merged.jsonl
# Confirm that every line parses (prints OK, or the first error)
jq -c . merged.jsonl > /dev/null && echo OKThe number of records should equal the sum of the valid records in each input, minus the duplicates removed. The result panel shows each of those numbers. To read the merged data as rows and columns, convert it with JSONL to JSON and open the array in JSON to Table or JSON to Excel. Records with nested objects fit a table better after the JSON Flattener.
| Problem | Cause | Fix |
|---|---|---|
| One line holds two records: {"id": 3}{"id": 4} | A file did not end with a line break, so cat joined its last line to the first line of the next file. | Merge with awk 1 or with this tool. Both treat the end of a file as the end of a line. |
| The first line of the second file is invalid, but it looks fine | The file starts with a byte order mark, which is invisible in most editors. | Read with utf-8-sig in Python, or merge here. The tool removes byte order marks, including ones in the middle of a file that was built with cat. |
| Every line of one file is invalid | The file is a pretty-printed JSON array or object, or it was saved as UTF-16 without a byte order mark. | A single array or object is detected here and converted. For several pretty-printed objects in a row, run jq -c . first. |
| "Unexpected token" on lines that end with a comma | The lines were copied out of a JSON array, so each record still has its trailing comma. | Remove the commas, or put [ and ] around the text so it is a real array. |
| An id such as 9007199254740993 comes out as 9007199254740992 | A tool parsed the number as a 64-bit float and wrote it back. | Copy lines as text. Here, leave Keep original text on. In scripts, write the original line, not the parsed value. |
| Fewer records than expected after merging | Duplicate removal matched more than you meant, for example a key that repeats across unrelated record types. | Check the Duplicates removed count, then switch to a more specific key or to Exact duplicate records. |
If a merged file is too large for the program that has to read it, cut it back into parts. JSONL can be split on any line break without breaking a record; see how to split JSON files or use the JSON File Splitter. To find the exact line that an import job complained about in a very large file, the Large Text File Viewer can jump to a line number without loading the whole file. More converters and editors are listed on the JSON tools page.
Inspect the merged records, convert them to a JSON array, or explore more JSON tools.