JSON and Code: Multi-Source Merge and Normalize Template
A Webhook kicks off a Parallel fan-out that gathers data from several sources, then the json and code connectors merge and normalize the differing shapes into one canonical record.
What It Builds
This template starts from a Webhook trigger and uses a Parallel node to fan out into concurrent branches, each fetching the same entity from a different source through the http connector. When the branches rejoin, Connector nodes on the json connector merge the responses and pick the fields you care about, and a Connector node on the code connector normalizes naming, types, and formats into one consistent record. The result is a single clean object you can hand to any downstream step. This is the aggregation pattern in Spojit: gather in parallel, then reconcile into one canonical shape.
The Prompt
Paste this into Miraxa and it builds the workflow, connecting the tools for you:
Build a workflow that starts from a Webhook trigger carrying a customer id. Add a Parallel node that fans out into three branches, each using the http connector to GET that customer record from a different REST API. After the branches rejoin, use the json connector to merge the three responses into one object and pick the fields name, email, and total_spend. Then use the code connector to run JavaScript that normalizes the merged object into a canonical record: lowercase the email, convert total_spend to a number, and rename every field to camelCase. Output the single normalized record.
Connectors Used
- Webhook trigger - an external system POSTs the entity id that starts the run, verified by a signing connection.
- http -
http-getin each Parallel branch fetches the same entity from a different REST API. - json -
mergecombines the branch responses andpickkeeps only the fields you need. - code -
execute-javascriptnormalizes naming, types, and formats into one canonical record.
Customize It
Change the number of branches in the prompt to match how many sources you have, and swap the field list in the pick step for the keys you actually care about. If two sources disagree, tell Miraxa which one wins so the merge precedence is clear, and adjust the normalization rules (date formats, currency, casing) in the execute-javascript step. To push the canonical record onward, add a Connector node to your destination after the code step.
Tips
- Keep each fetch in its own Parallel branch so the slowest source sets the pace instead of the sum of all of them.
- Reference branch outputs explicitly when merging, for example
{{ source_a.data }}and{{ source_b.data }}, so themergeorder and precedence stay predictable. - The http, json, and code connectors run in Direct mode and cost no AI credits, which makes this an efficient pattern to run often.
Common Pitfalls
- If one source returns a different shape than expected, the
pickstep silently drops the missing key. Guard for absent fields insideexecute-javascriptbefore you rely on them. - One slow or failing API can stall the whole fan-out. Decide whether a branch failure should fail the run or be tolerated, and confirm each branch's retry behavior.
- Mismatched types (a number arriving as a string, an ISO date versus a Unix timestamp) are the usual cause of bad merges. Do all type coercion in the
codestep, not before it.