Converting web hook payload array of collections into HTTP request JSON

I am trying do a simple conversion of a one http request payload, received through a webhook block, into a differently formatted http request payload that is sent from an http block.


The incoming payload has a field which holds an Array of Collections, where each collection can have different structure. If I try to add that field as the value in my custom format in the HTTP block, it beaks the JSON formatting and the request content looks like:

{
  "event_type":"custom_event",
  "payload":{
    "name": "Hello",
    "custom_fields":{[Collection], [Collection], [Collection]}
  }
}

How can I achieve a request where the collections are “unpacked” as individual JSON blobs?

{
  "event_type":"custom_event",
  "payload":{
    "name": "Hello",
    "custom_fields":[
      {"key":"value","key":"value",...},
      {"key":"value","key":"value",...},
      {"key":"value","key":"value",...}
    ]
  }
}

Have you tried the create json app? Alternatively you can iterate the array with an iterator to create the necessary json text. What’s the best way to combine data from multiple modules and output it in a Make An API Call module?

1 Like