Iterating over a JSON array

Hi all,
Want to iterate over a JSON array and don't know how to formulate the JSONgetElement.
This works in the data viewer:

JSONGetElement ( CustomFunc::JSON;"rss.channel.item[5].guid" )

But when I try to do this , I get an error.

JSONGetElement ( CustomFunc::JSON;"rss.channel.item[$index].guid" )

i.e When I insert the local variable $index , I get an error - like so:
? * Offset 17 in "rss.channel.item[$index].guid"
JSON path syntax error.

So how do I do this ?
thanks
Kevin

JSONGetElement ( CustomFunc::JSON;"rss.channel.item[" & $index & "].guid" )

you need to use $index and not just put $index as text there.
JavaScript doesn't know what $index should be.

6 Likes

Thanks a lot.
Yeah, it was that part that I was not getting. Works great now .
Kevin