SOLVED

Webhook - Need help to parse the JSON response

Go to solution
Karthik_Logan1
Level 2

Webhook - Need help to parse the JSON response

Hi Everyone,

I successfully retrieved data from AEP using a Webhook. Here is the response.

 

 

{
    "BVr123": {
        "entityId": "BVr123",
        "entity": {
            "CommerceSite": {
                "latestCommerceEventDate": "2023-10-16T20:54:32.175Z",
                "productList": [
                    {
                        "name": "LAB DEMO",
                        "quantity": 2,
                        "priceTotal": 48.99,
                        "SKU": "310",
                        "CommerceSite": {
                            "productHierarchyCode": "804"
                        },
                        "productCategories": [
                            {
                                "categoryName": "Classroom-Kits"
                            }
                        ]
                    },
                    {
                        "name": "NPL",
                        "quantity": 1,
                        "priceTotal": 85.19,
                        "SKU": "418",
                        "CommerceSite": {
                            "productHierarchyCode": "907"
                        },
                        "productCategories": [
                            {
                                "categoryName": "Classroom-Kits"
                            }
                        ]
                    },
                    {
                        "name": "DIGITAL METER",
                        "quantity": 4,
                        "priceTotal": 169.0,
                        "SKU": "586",
                        "CommerceSite": {
                            "productHierarchyCode": "804"
                        },
                        "productCategories": [
                            {
                                "categoryName": "Clinometers"
                            }
                        ]
                    }
                ],
                "latestCommerceEvent": "commerce.productListAdds"
            }
        },
        "lastModifiedAt": "2023-11-17T01:17:39Z"
    }
}

 

 

 

I require assistance in parsing JSON data to save it in Marketo custom fields. Specifically, I aim to store the latest commerce event, product list, latest commerce event date in three distinct custom fields. Please note that "BVr123" serves as a unique identifier for each individual and will vary for each person.

@SanfordWhiteman Could you please share your thoughts.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Webhook - Need help to parse the JSON response

You won’t be able to directly parse and map this response because the top-level property name is dynamic.

 

Best you can do is go via a webhook gateway that can pre-parse and transform the payload into something Marketo can understand.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Webhook - Need help to parse the JSON response

You won’t be able to directly parse and map this response because the top-level property name is dynamic.

 

Best you can do is go via a webhook gateway that can pre-parse and transform the payload into something Marketo can understand.