Extracting Nested JSON Data in Zoho Flow Deluge Function from Airtable Webhook

Hey everyone,

I’m stuck on a Zoho Flow project and could use some advice. I’ve got a Flow that’s triggered by an Airtable webhook, which sends a pretty complex JSON payload. My problem is figuring out how to grab the nested data inside the Deluge custom function.

Here’s what I’m dealing with:

{
  "webhookTrigger": {
    "payload": {
      "CustomerID": 12345,
      "OrderInfo": {
        "OrderNumber": "ORD-9876",
        "Items": [
          {
            "Name": "Widget A",
            "Quantity": 2
          },
          {
            "Name": "Gadget B",
            "Quantity": 1
          }
        ]
      },
      "ShippingDetails": {
        "Address": "456 Elm St",
        "City": "Somewhere",
        "ZipCode": "54321"
      }
    }
  }
}

I’m having trouble getting to stuff like the order number or the shipping address. Anyone know how to navigate this in Deluge? Thanks for any tips!

Having worked extensively with Zoho Flow and complex JSON payloads, I can offer some insights. The key is to use the map() function in Deluge for efficient data extraction. Here’s a streamlined approach:
payload = webhookTrigger.get(‘payload’);
orderInfo = payload.get(‘OrderInfo’);
shippingDetails = payload.get(‘ShippingDetails’);

customerID = payload.get(‘CustomerID’);
orderNumber = orderInfo.get(‘OrderNumber’);
items = orderInfo.get(‘Items’).map(item => item.get(‘Name’) + ‘: ’ + item.get(‘Quantity’)).join(’, ');
address = shippingDetails.get(‘Address’) + ', ’ + shippingDetails.get(‘City’) + ’ ’ + shippingDetails.get(‘ZipCode’);

This method allows you to quickly access nested data and even process arrays in a single line. It’s more concise and less prone to errors than nested loops. Remember to implement error handling for robustness in production environments.

hey lucasg, i’ve been there with complex json in zoho flow. here’s a quick tip:

data = webhookTrigger.get(‘payload’);
orderNum = data.get(‘OrderInfo’).get(‘OrderNumber’);
address = data.get(‘ShippingDetails’).get(‘Address’);

for items, try:
items = data.get(‘OrderInfo’).get(‘Items’);
foreach item in items
{
// process item data
}

hope this helps ur project!

I’ve dealt with similar nested JSON structures in Zoho Flow before, and I can share what worked for me. In Deluge, you can access nested data using dot notation. For your specific case, try something like this:

webhookData = webhookTrigger.get(‘payload’);
customerID = webhookData.get(‘CustomerID’);
orderNumber = webhookData.get(‘OrderInfo’).get(‘OrderNumber’);
shippingAddress = webhookData.get(‘ShippingDetails’).get(‘Address’);

For arrays like ‘Items’, you can use a loop:

items = webhookData.get(‘OrderInfo’).get(‘Items’);
for item in items {
itemName = item.get(‘Name’);
itemQuantity = item.get(‘Quantity’);
// Do something with each item
}

This approach should help you extract the nested data you need. Just remember to handle potential null values to avoid errors. Hope this helps with your Zoho Flow project!