Skip to content
Data & Databases

NDJSON Record Framing Gate Before Parsing

9 nodes 5 0 Manual trigger
Download

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. 1.Run the workflow manually; the first Code node emits fictional 8-line NDJSON text covering valid and defective cases.
  2. 2.The Set node fixes the empty-line policy (reject), size cap (500 chars), and recorded-issue cap (20).
  3. 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. 4.The IF node checks overall readiness and routes the report to the ready or review branch.
  5. 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

  1. Import the JSON into n8n (2.49.8+) and execute the Manual Trigger.
  2. Verify the final report shows route needs_review with 6 issues over 8 lines and ready lines [1,2].
  3. Replace the sample with all-valid lines and allowEmptyLines true, then confirm route becomes ready_for_parse with no issues.
  4. 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

Manual Trigger Code Set If Merge

Details

Trigger Manual trigger
Nodes 9
Apps 5
Views 5
Downloads 0

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (9)

/

ملاحظة: الإدخال والسياسة

Sticky Note

#1

ملاحظة: المسح والتأطير

Sticky Note

#2

ملاحظة: التوجيه والإخراج

Sticky Note

#3

تشغيل يدوي

Manual Trigger

#4

بيانات NDJSON تجريبية

Code

#5

تعريف سياسة التأطير

Set

#6

ماسح تأطير NDJSON

Code

#7

هل كل الأسطر جاهزة؟

If

#8

مسار الجاهز للتحليل

Code

#9

مسار المراجعة

Code

#10

دمج مسارات التوجيه

Merge

#11

التقرير النهائي الموحد

Code

#12
Stay in the loop

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

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime