Safe Final Text Composer from Nested Objects
Loading workflow…
Workflow Description
A fully self-contained workflow starting from a manual trigger that generates serializable fictional sample items, then a Code node inspects the type of every composition field: primitives are used directly, objects are safely serialized via JSON.stringify with an «object» source tag to prevent [object Object]. The unserializable case is simulated inside the compose node itself via a safe marker, failed fields are routed by an IF node to a manual-review path, a Merge node appends both paths, and a final Code node emits one aggregate report with counts and failed-field details.
How it works
- 1.Run the manual trigger; the first Code node emits three fictional items: plain text, a nested title object, and an item flagged to simulate an unserializable field
- 2.Compose Final Text builds the throwing object locally, checks typeof for title/summary/status, builds final_text, and records composition_tags per part
- 3.IF routes completed items to Label Completed Output and failed ones to Label Review Items with failed field names
- 4.Merge (append, two separate inputs) joins both paths without dropping items
- 5.Build Final Report produces a single report item with counters, IDs, and review details
Use cases
- Composing titles and summaries from heterogeneous JSON payloads with nested objects
- Sanitizing report lines before feeding templates or documents
- Triaging records needing human review before final line generation
Requirements
- n8n 2.46.6 with code, set, if, merge, stickyNote and manualTrigger nodes
- No credentials and no external calls whatsoever
- For real use: replace the sample generator with any source producing the same schema (id, title, summary, status)
Setup and testing in n8n
- Import the JSON in n8n and execute the Manual Trigger
- Verify item B-202's final text contains indented JSON of the object tagged «object» and no [object Object]
- Verify C-303 is routed to review due to the simulated unserializable title field and the report shows 2 composed, 1 review
- Edge test: empty the sample array (return []) to confirm empty-input 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 (8)
Manual Trigger
Manual Trigger
Generate Fictional Sample Items
Code
Compose Final Text
Code
Fully Composed?
If
Label Completed Output
Set
Label Review Items
Set
Merge Both Paths
Merge
Build Final Report
Code
Stage 1 Docs
Sticky Note
Stage 2 Docs
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