Unable to access JSON offer into Email template for rendering | Community
Skip to main content
KotiSyamala
New Participant
May 1, 2025
Question

Unable to access JSON offer into Email template for rendering

  • May 1, 2025
  • 2 replies
  • 668 views

Trying to access the JSON offer in the email template for custom rendering format. The offers are stored as JSON. (Saved the JSON into HTML placemnt)

 

Trying ways to access JSON as an object in an email template to custom render. 

 

<% let selectedOffer = offer.html['dps:offer-placement:12324324']['sps:offer-activity:32423423'].content %> {{selectedOffer}}

 

It throws an error when rendering JSON. Any suggestions would help.

2 replies

Mohan_Dugganab
Employee
May 2, 2025

You can use the following snippet as an example 

{{{offer.html.[dps:offer-placement:19d91803ed87a1a0].[dps:offer-activity:1a9a487ec2b1a708].content}}}
KotiSyamala
New Participant
May 2, 2025

It'll directly renders the JSON, but wanna capture in a variable and handle with custom rendering.

 

<% let contentValJSON = offer.html.['dps:offer-placement:1a9ce5b1668c0f58'].['dps:offer-activity:1a9ce7b236595802'].content %>
 
Unable to capture JSON into a variable
{{contentValJSON}}
Mohan_Dugganab
Employee
May 2, 2025

Try using it on the following lines 

{{#with offer.html.[dps:offer-placement:1a9ce5b1668c0f58].[dps:offer-activity:1a9ce7b236595802].content as |val|}} {%= val %} {{/with}}