Describe the problem/error/question
I am trying to configure a Function/Code node that takes two inputs of different type.
The first input is the result of an API call which contains a lot of IDs which aren’t understandable easily. I want to “convert” these IDs into actual texts. The IDs aren’t only as values of the JSON but as headers as well.
The second input is a mapping JSON between the IDs and their corresponding texts.
A simple function/code node should be able to do the mapping correctly, converting the IDs found in the first JSON into actual texts, and outputting a new, understandable and clean JSON.
I’ve connected the two inputs (mapping function & API result) into one function node, however that function will be applied to the two inputs & thus output two different JSON, which is not what I want.
I have tried a “Merge” node, however this merges datasets/JSONs that are similar in structured, either appending both datasets or finding common matches. This is not my case as one dataset is a JSON of my data, and the other is a sort of metadata mapping dataset. My two input datasets are different in type.
I have also tried “Execution data” node however this node is more convenient for very isolated variables. In my mapping JSON, I have around 40 objects that map IDs with texts so it’s not very useful to use the Execution data and call it.
Please share your workflow
Share the output returned by the last node
The output of the last function will basically be two outputs: the function applied on all the input items.
I don’t really want that - I want a single output but the function should indeed use the two inputs, just in different ways because they are two different types of input.
Is it possible to handle different types of inputs in a Function node?
Many thanks for the help!
Information on your n8n setup
- n8n version: 1.82.3
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
- Operating system: MacOS Sequoia 15.3.1