Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save camrobert/3f02f01ca48296855fe5523b343d9683 to your computer and use it in GitHub Desktop.
Save camrobert/3f02f01ca48296855fe5523b343d9683 to your computer and use it in GitHub Desktop.
Recreate the BuildRowsetFromJson Documentation Usage Example
%%[
SET @json = '{"Flights": [{"Origin": "IND","Dest": "NYC","Price": 100.0},{"Origin": "IND","Dest": "LAX","Price": 200.0},{"Origin": "IND","Dest": "SEA","Price": 500.0,"PerBagSurcharge": 25}]}'
SET @rows = BuildRowsetFromJson(@json, '$.Flights[*]', 1)
]%%
<table border=1>
<tr><th>Origin</th><th>Dest</th><th>Price</th><th>PerBag Surcharge</th></tr>
%%[FOR @i = 1 TO Rowcount(@rows) DO]%%
<tr>
%%[FOR @c = 1 TO 4 DO]%%
<td>%%=Field(Row(@rows,@i),@c)=%%</td>
%%[NEXT @c]%%
</tr>
%%[NEXT @i]%%
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment