Skip to content
Data & Databases

Safe Final Text Composer from Nested Objects

8 nodes 34 2 Manual trigger
Download

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. 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. 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. 3.IF routes completed items to Label Completed Output and failed ones to Label Review Items with failed field names
  4. 4.Merge (append, two separate inputs) joins both paths without dropping items
  5. 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

  1. Import the JSON in n8n and execute the Manual Trigger
  2. Verify item B-202's final text contains indented JSON of the object tagged «object» and no [object Object]
  3. Verify C-303 is routed to review due to the simulated unserializable title field and the report shows 2 composed, 1 review
  4. 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

Manual Trigger Code If Set Merge

Details

Trigger Manual trigger
Nodes 8
Apps 5
Views 34
Downloads 2

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 (8)

Manual Trigger

Manual Trigger

#1

Generate Fictional Sample Items

Code

#2

Compose Final Text

Code

#3

Fully Composed?

If

#4

Label Completed Output

Set

#5

Label Review Items

Set

#6

Merge Both Paths

Merge

#7

Build Final Report

Code

#8

Stage 1 Docs

Sticky Note

#9

Stage 2 Docs

Sticky Note

#10
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