Structure flat webhook request to be able to iterate over it

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of four modules:

0. Set Webhook to Pass-through

You can do that by setting the Webhook “JSON Pass-through” to YES (it is “No” by default), when creating or editing a webhook.

Then, you will be able to map the entire JSON body payload in another module.

1. Match pattern in your webhook JSON

Use a Text Parser “Match Pattern” module with this regular expression pattern

"(?<key>[^"]+)_(?<number>\d)": "?(?<value>[^"]+)(?:"|,)+\s

Regex test: https://regex101.com/r/34Y18M

Important Info

  • :warning: Global match must be set to YES!

2. Aggregate to Text #1 with   "key":"value", group by item number

3. Aggregate to Text #2 with   {}  object wrapper

4. Parse JSON with array wrapper

You can copy this so you don’t have to type it out, insert variable between square brackets

{"items":[ ]}

Output

Screenshot_2024-01-17_200106

Give it a go and let us know if you have any issues!

3 Likes