Parse the JSON String using Velocity Script
Hi Everyone,
Our Goal: Display recommended products from Adobe Target in Marketo emails.
I successfully sent a request to Adobe Target through a Marketo webhook and received a product recommendation JSON response. I need to display the recommended products in Marketo email using Velocity script.
{
"status": 200,
"requestId": "74c07edd",
"client": "ABC",
"id": {
"tntId": "1234aaa"
},
"edgeHost": "mboxedge34.net",
"execute": {
"mboxes": [
{
"index": 1,
"name": "apitest",
"options": [
{
"content": {
"recommendedItems": {
"key": "key01",
"slot01": "product01",
"slot02": "product02",
"slot03": "product03",
"slot04": "product04"
}
},
"type": "json",
"sourceType": "target"
}
]
}
]
}
}
I'm storing the response value in a Marketo custom text field, but there's a discrepancy between the actual response and the stored response - additional text like "Map" and "List" has been inserted.
Map(mboxes -> List(Map(index -> 1, name -> apitest, options -> List(Map(content -> Map(recommendedItems -> Map(slot03 -> product03, slot02 -> product02, slot04 -> product04, slot01 -> product01, key -> key01)), type -> json, sourceType -> target)))))
I need assistance with converting/parsing JSON and displaying all slot information in an email using Velocity script.
@sanfordwhiteman please share your valuable inputs here.
Thanks,
Karthik