Ah yeah sorry I forgot to launch dropbox, now it's updated
And for your foreach, first, remember to not do it every tick, that's the reason why it wasn't stopping. You can nest it under the start of layout event for it to just run once.
Now as far as foreach goes, you're using it correctly.
However, you have two ways to loop through arrays:
- foreach as you did
- "index looping", basically go from 0 to the size of the array-1 and use loopindex in the path to look up the values (that's actually what is usually done in common programming)
The two mecanisms have a slightly different behaviour that can be seen in this capx: JSONDasat-holy-array.capx
As far as I could test, the foreach keeps the proper array ordering.
Looping using foreach is like considering the array as an object. And objects have no intrinsic ordering. So the foreach keeping the ordering shouldn't be expected, even if, it seems that does it, at least on chrome....
I dunno if it's consistent throughout all the browsers, so I usually use index looping.
Now your other problem is that you're printing the keys using JSON.CurrentKey, if you want the content, you need to use JSON.CurrentValue
In your case, the value for "friends" is an array, so you need to detect that, you can either use the Is Array condition or check if CurrentKey = "friends".
I would personally check for Array 'cause this way you can change the name of the field if you need it.
Anyway, it should look something like that JSONDasat-foreach.capx