Fireche
You are running into a subtlety.
> CurrentKey
> In a For each loop, a string of the current key name. If an array is being looped, the current key is a string of the current index, e.g. "0", "1"...
Since your data is in an array, CurrentKey will have indexes to the array. What you need to do then is load what is at that path in the json into another JSON plugin instance and then loop through that. Because the new loop in on a json object, CurrentKey will have the key names as strings.
https://www.dropbox.com/s/3zzdt1yjk9riwwr/ReadingJSON.c3p?dl=0
The example does just that. The only thing which is rather cryptic is the path you need to give to GetAsCompactString to extract a single item from the json array.
For this example JSON, doing JSON.GetAsCompactString("array.0") gets you the first item as a string, which you can load into another JSON object using the Parse action.
> {
"array": [
> {"foo": "1"},
> {"bar": "2"}
> ]
}
An extra detail I noticed while puting the example together, it seems the path you need to give to GetAsCompactString has to be absolute.
It's a little weird since dictionaries do return the key name, and this is essentially the same thing.
Also looking at the example browser projects json example the for each
For each entry in "books", text append "Book title: " & JSON.Get(".title") & newline
Is a little convoluted since the "books" string in automatically implied rather than also returning the index.
Then don't get me started on how that works with the dot in the json.get. I mean ok sure its key.pair, but using .pair really throws me a brain fart.