NDJSON Record Framing Gate Before Parsing
Loading workflow…
Workflow Description
A manually triggered workflow that inspects raw text labeled NDJSON with a local character scanner tracking strings, escape characters, and bracket depth. Each line is classified as ready to parse, structure spanning multiple lines, trailing content or multiple root values, empty line violating policy, structural error, or later parse failure. The report routes to the ready path only when all lines pass framing and parsing; error reports contain line numbers and neutral reasons only, never field values.
How it works
- 1.Run the workflow manually; the first Code node emits fictional 8-line NDJSON text covering valid and defective cases.
- 2.The Set node fixes the empty-line policy (reject), size cap (500 chars), and recorded-issue cap (20).
- 3.The scanner walks the text character by character tracking strings, escapes, and depth, applying JSON.parse only to lines that passed the framing check.
- 4.The IF node checks overall readiness and routes the report to the ready or review branch.
- 5.Branches merge and a final Code node outputs one summary item with route, ready lines, and issues with line numbers and approximate positions.
Use cases
- Import teams proving each record is independent before bulk parsing
- Quality gate in front of an NDJSON parser in a data pipeline
- Auditing log files where parsing could erase the original error evidence
Requirements
- No network, credentials, or persistent storage: everything runs locally inside Code nodes.
- To use real input: remove the sample Code node and feed your source into rawText plus allowEmptyLines, maxLineChars, maxIssues.
- Input is one raw text string; the workflow never modifies or executes the text.
Setup and testing in n8n
- Import the JSON into n8n (2.49.8+) and execute the Manual Trigger.
- Verify the final report shows route needs_review with 6 issues over 8 lines and ready lines [1,2].
- Replace the sample with all-valid lines and allowEmptyLines true, then confirm route becomes ready_for_parse with no issues.
- Test empty input or an item without rawText and confirm graceful handling.
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)
ملاحظة: الإدخال والسياسة
Sticky Note
ملاحظة: المسح والتأطير
Sticky Note
ملاحظة: التوجيه والإخراج
Sticky Note
تشغيل يدوي
Manual Trigger
بيانات NDJSON تجريبية
Code
تعريف سياسة التأطير
Set
ماسح تأطير NDJSON
Code
هل كل الأسطر جاهزة؟
If
مسار الجاهز للتحليل
Code
مسار المراجعة
Code
دمج مسارات التوجيه
Merge
التقرير النهائي الموحد
Code
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