Parsing data received from webhooks

:bullseye: What is your goal?

I need to parse a webhook from the WayForPay payment gateway and send the data to Zoho CRM. The goal is to extract the customer’s email, order reference, and a list of products (name, price, count) to create a Deal and update a Contact in Zoho.

:thinking: What is the problem & what have you tried?

The problem is that WayForPay sends the callback as a raw JSON string inside an array, and the products field is further nested as a string-key within an object.
Example of the raw data I receive:
[{"{"merchantAccount":"...","products":{"{\"name\":\"Product\",\"price\":1,\"count\":1}":""},"email":"user@example.com"}}"]
I have tried using the JSON > Parse JSON module, but it only parses the first level. I am stuck with “double-escaped” strings for the product details. I do not have access to the Premium “Make Code” module, so I need a solution using standard modules or formulas (like map(), get(), parseJSON(), or replace()).

:clipboard: Error messages or input/output bundles

Input Bundle from Webhook:
Code:
[
{
“data”: “[{“merchantAccount":“notion_site”,“orderReference”:“SHC-FBDLT2”,“merchantSignature”:“a1bc326c2d564cf7f3e8457246a”,“amount”:1,“currency”:“UAH”,“authCode”:“962356”,“email”:“dariavereshchaeva@gmail.com”,“phone”:“380954500000”,“createdDate”:1772192167,“processingDate”:1772192208,“cardPan”:“34****3456”,“cardType”:“MasterCard”,“issuerBankCountry”:“Ukraine”,“issuerBankName”:“JSC CB PRIVATBANK”,“recToken”:”“,“transactionStatus”:“Approved”,“reason”:“Ok”,“reasonCode”:1100,“fee”:0.02,“paymentSystem”:“applePay”,“acquirerBankName”:“WayForPay”,“cardProduct”:”“,“clientName”:null,“products”:{”{“name”:”\u0428\u0430\u0431\u043b\u043e\u043d",“price”:1,“count”:1}“:”“}}]”
}
]

The specific issue:
The products field looks like this:
“products”:{“{“name”:”\u0428\u0430\u0431\u043b\u043e\u043d",“price”:1,“count”:1}“:”"}
I need to extract the name, price, and count from that key.

1 Like

hey Daria, WayForPay’s API is notoriously messy with these payloads.

what is happening here is that the API is passing your product data as the key of the object, rather than the value. Since the data is trapped as a key, a standard Parse JSON module cannot read it natively.

to fix this without the premium code module, youneed a two- step extraction. First, use Make’s built-in keys() function to extract the string: {{get(keys(1.products); 1)}}. Then, pass that extracted string through a second Parse JSON module. This will decode the unicode and give you clean variables for name, price, and count.

i just mapped out the exact module flow for this - check your PMs, i dropped the screenshot there for you.

1 Like