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;"[5].guid" )

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

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

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

So how do I do this ?

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

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


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