Verified JSON Lines Packer with Per-Line Rejection Isolation
Loading workflow…
Workflow Description
A fully local workflow that converts each incoming item into exactly one canonical JSON line with sorted keys, then re-parses that line and compares canonical forms to prove round-trip recoverability. It also checks item shape, nesting depth, line length and embedded newlines. An IF node routes verified lines to the accepted branch and failures to the rejected branch with a reason, and a Merge node joins both. A final Code node returns one standard item containing the JSONL document built from accepted lines only, plus counts and rejected line numbers with reasons, never using implicit object stringification.
How it works
- 1.Manual Trigger starts the run.
- 2.Sample Records emits five fictional records (three valid, one oversized, one too deep).
- 3.Serialize And Verify Lines builds and verifies one canonical line per item.
- 4.IF splits ok=true from ok=false.
- 5.Two Set nodes add line_status and rejection_reason while keeping other fields.
- 6.A NoOp audit path feeds Merge input 2.
- 7.Build JSON Lines Report returns a single item with the JSONL document and inventory.
Use cases
- Prepare a JSONL payload for export or local storage
- Prevent [object Object] when stringifying nested objects
- Pinpoint which batch item failed and why
- Prove each line is recoverable before downstream delivery
Requirements
- n8n 2.48.7 or compatible
- Input items whose json is a plain object
- No credentials or network access needed
- Adjust length and depth limits inside the Code node if required
Setup and testing in n8n
- Import the JSON and open the workflow.
- Click Execute Workflow and inspect Build JSON Lines Report.
- Confirm total_items=5, accepted_count=3, rejected_count=2, counts_balanced=true.
- Confirm contains_object_object_literal=false and the document has three lines.
- Edge case: add an empty {} record and verify it is accepted as line {}.
- Invalid case: lengthen notes or deepen nesting and verify the reason appears in rejected_lines.
Service Value
Ready-made workflow template for automation delivery and service execution.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (9)
Manual Trigger
Manual Trigger
Sample Records
Code
Serialize And Verify Lines
Code
Line Verified?
If
Mark Accepted Line
Set
Mark Rejected Line
Set
Rejected Audit Trail
No Op
Merge Line Branches
Merge
Build JSON Lines Report
Code
Note Input Contract
Sticky Note
Note Verification Policy
Sticky Note
Note Output And Setup
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides