Skip to main content
Notice removed Draw attention by SFDC FanBoy
Bounty Ended with Gortonington's answer chosen by SFDC FanBoy
Notice added Draw attention by SFDC FanBoy
Bounty Started worth 50 reputation by SFDC FanBoy
Tweeted twitter.com/StackSalesforce/status/1288444207502434305
add marketing-cloud, ampscript, gtl tags
Link
Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88
Source Link

How does Guide Template Language parse a straight JSON array?

I'm learning Guide, and I've been able to parse an array of objects...

AmpScript:

set @json = '[{"voucher":"123456789"}, {"voucher":"234567890"}]'

Guide:

    {{.dataobject JsonVar type=variable source=@json maxrows=20}}
       {{.data}}
            {"target":"@json"}
       {{/data}}
    {{/dataobject}}
    {{#each JsonVar}}
       <p>{{voucher}}</p>
    {{/each}}

Returns:

123456789
234567890

But what if I want to return the same output, but instead from a simpler array?

set @json = '["123456789", "234567890"]'

I've tried everything I can find here, and in the docs, with no luck so far. Any help would be greatly appreciated!