[SalesForce] Can AMPScript parse JSON

Using AMPScript to parse an XML feed. Client is switching to JSON. Is there something similar to BuildrowsetfromXML() for JSON in AMPScript? I am confined to using the members login area and not an external API application.

Best Answer

Here's a simple Guide Template Language example:

%%[

var @Json
set @Json = '[{"name": "john doe","email": "john.doe@mail.com"},{"name": "jane doe","email": "jane.doe@mail.com"}]'

]%%
{{.dataobject JsonVar type=variable source=@Json maxrows=20}}
     {{.data}}
          {"target":"@Json"}
     {{/data}}
{{/dataobject}}
{{#each JsonVar}}
  <br><br>Name: {{name}}
  <br>Email: {{email}}
{{/each}}

Output

Name: john doe 
Email: john.doe@mail.com 

Name: jane doe 
Email: jane.doe@mail.com 

NOTE: This doesn't appear to work in Content Builder.

2020210 EDIT: I don't recommend using GTL in SFMC. My preferred method is what SebOB described.

20210629 EDIT: Does work in CloudPages with a hack.