Set Expression Generator from Nested JSON String with Verification
Loading workflow…
Workflow Description
Self-contained manual workflow emits two fictional items: a valid nested JSON string and a broken one. A Code node parses each inside try/catch, recursively traverses with no depth limit, and emits rows (path, value, type, ready n8n expression) with internal verification that each path resolves to its listed value. Broken text yields one diagnostic row with a deterministic reason; an IF node separates valid rows from failure rows, a Merge appends them, and a final Code node builds one summary report with counters and a paste-ready expression list. The forum Object.entries pattern is documented on a sticky note.
How it works
- 1.Run manually; sample node emits a valid and a broken JSON text item
- 2.Code node safely parses and recursively generates rows with internal path verification
- 3.Set node standardizes fields and retains identifiers via includeOtherFields
- 4.IF node splits valid path rows from the diagnostic failure row
- 5.NoOp branches feed a two-input append Merge
- 6.Final Code node returns one summary report with counters, failure reasons and expressions
Use cases
- Turn nested JSON-in-JSON text into ready n8n expressions
- Generate verified path lists for Set or IF nodes
- Diagnose JSON parse errors (single quotes, trailing comma) without stopping execution
- Document unknown payload structure before building the final workflow
Requirements
- No credentials; no external calls or AI
- For real use: feed any item with a string `payload` field instead of the sample node
Setup and testing in n8n
- Import the JSON into n8n, open Manual Trigger, click Execute
- Check Build Summary Report: 13 verified valid rows and 1 failure row (single quotes reason)
- Edge cases: empty payload, empty array, key with spaces, deeply nested JSON
- Copy ready_expression values into a Set node and confirm evaluation
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
Build Sample Payloads
Code
Parse JSON & Generate Verified Paths
Code
Format Expression Rows
Set
Is Parse OK
If
Valid Paths Branch
No Op
Failure Diagnostics Branch
No Op
Combine All Rows
Merge
Build Summary Report
Code
Sticky: Stages & Object.entries Pattern
Sticky Note
Sticky: Setup & Usage
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