How the JSONL Cleaner Processes Your File
JSON Lines (JSONL/NDJSON) stores one JSON record per line. The tool processes each line independently, removes blank records and lines that fail JSON parsing, and continues with the remaining lines. Records that pass the selected rules are written as JSONL output.
Add JSONL Data and Choose Cleanup Controls
Paste JSONL/NDJSON content or drop a file into the tool. The file picker accepts JSONL, NDJSON, and TXT. For a loaded file longer than 200,000 characters, the text box shows a truncated preview while the full content is still processed.
Use Trim string values to remove leading and trailing whitespace from strings. Under Deduplicate, choose Do not deduplicate, By full cleaned line, or By a selected key.
What the Cleanup Rules Remove or Change
Blank or whitespace-only lines are removed and counted. A final newline is ignored as a non-record, so it is not counted as a discarded blank line. Lines that fail JSON parsing are removed with their line number and parser error, while processing continues.
Trim string values works recursively through objects and arrays. Kept records are written with compact JSON.stringify serialization, so their original whitespace and formatting are not preserved.
Deduplicate by Line or Key
By full cleaned line compares the complete cleaned, serialized record and keeps the first match. By a selected key compares the value of the field named in Key name to dedupe by and keeps the first record for each value. Records that are not objects or lack that key are not treated as duplicates by key.
When By a selected key is active, enter a value in Key name to dedupe by. If it is empty, the tool displays an error and does not process the data.
Review the Results and Export Files
Processing starts automatically after usable input or a settings change. The Changes made area reports lines read, records kept, blank lines removed, invalid JSON lines removed, duplicates removed, and strings trimmed.
The Cleaned JSONL output preview shows the first 500 kept records. Use Copy Cleaned JSONL or Export JSONL for the full cleaned result. The report table shows up to 500 rows that were discarded or kept with string values trimmed, including original and cleaned content where available. Export Discard Report (CSV) exports the full report; displayed content is limited to 200 characters per cell.
How to Use the JSONL Cleaner
- Paste JSONL/NDJSON text, or drop or browse for a JSONL, NDJSON, or TXT file.
- Set Trim string values and choose a Deduplicate option.
- If you choose By a selected key, enter Key name to dedupe by.
- Review the counts and previews, then copy or export the result.
Limits and Scope
This tool is for line-delimited JSON datasets, not a single JSON document. It does not diagnose structural issues inside one document, flatten nested fields, or convert between formats. Use the JSON Cleaner for a single document and a converter for format changes. Valid records keep their structure unless trimming changes string values, but output formatting is reserialized.
Browser Processing and Error Cases
Parsing, cleaning, and export occur in the browser. Empty or whitespace-only input remains in a waiting state until usable JSONL/NDJSON is provided. An unreadable file shows an inline recovery error.
Frequently Asked Questions
How is this different from the JSON Cleaner?
The JSON Cleaner works on a single JSON document and cleans values inside its nested structure. This tool works on JSON Lines files, where every line is its own independent JSON record - it handles per-line parse failures, blank lines, and dataset-style deduplication and reporting that a single-document cleaner does not.
What happens to lines that are not valid JSON?
Any line that fails to parse as JSON is removed from the output and logged in the discard report with its original line number and the parse error message. It does not stop processing - the rest of the file is still cleaned.
How does deduplication by key work?
Choose a key name (for example, id) and the tool compares that field's value across all records. The first record with a given key value is kept; later records sharing that value are discarded and logged. Records that are not objects, or that do not contain the chosen key, are never treated as duplicates by key.
What is the discard report?
It lists discarded rows and kept rows where string values were trimmed, with the original line number, action, original content, and cleaned content where available. The table shows the first 500 entries; use Export Discard Report (CSV) for the full report.
Does this change the structure inside each record?
Only if you enable trimming, which strips leading/trailing whitespace from string values recursively inside each record. It does not reorder keys, flatten nested fields, or otherwise reshape valid records, but the output is reserialized and does not preserve the original formatting.