Skip to main content
2 of 2
add marketing-cloud, ampscript, gtl tags
Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88

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!