Can you merge JSON objects in the Flow "Transform Payload" operation

I essentially want to append a new field onto the JSON that I get from the trigger. If I was to just write it as a script I could just do

return {
    ...$trigger.payload,
    new_field: "value"
}

Is there a way to do this with the “Transform Payload” operation?

1 Answer

1

You should use something like this..

{
    "first": "{{ flow_output_A }}",
    "second": "{{ flow_output_B }}"
}

Ideally I'd like to return a single object which is identical to the original just with a new field, rather than having to split them arbitrarily over two keys.