sfmc // AMPscriptPROJECT
Iterate JSON Arrays with BuildRowsetFromJson()
Convert a JSON array into a rowset and iterate it in AMPscript.
ampscriptjsonbuildrowsetfromjsonapi event
Trust & provenancePROJECT
Evidence tierPROJECTOfficial sources0Other sources0Last verifiedNot recorded
Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.
%%[
VAR @json, @rows, @i, @row, @item
SET @json = AttributeValue('Cart_JSON')
SET @rows = BuildRowsetFromJson(@json,'$.Cart[*]',1)
IF RowCount(@rows) > 0 THEN
FOR @i = 1 TO RowCount(@rows) DO
SET @row = Row(@rows,@i)
SET @item = Field(@row,'Item')
Output(Concat('<br>Item: ',@item))
NEXT @i
ENDIF
]%%Validate the payload and expected path before rendering customer-facing content.