right now I have this JSON.
{ "kind": "youtube#channelListResponse", "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/SGu14Buo6xWrEuoFga6kBy4vZBs\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 1 }, "items": [ { "kind": "youtube#channel", "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/Gtb_6T1CwMLCWtseKBhUt_R95fg\"", "id": "UC-lHJZR3Gqxm24_Vd_AJ5Yw", "statistics": { "viewCount": "19368312391", "commentCount": "0", "subscriberCount": "73782288", "hiddenSubscriberCount": false, "videoCount": "3672" } } ] }
on line 9 you see an unnamed array but I have no Idea how to get the path for that.
I used this website to get what I used below: http://jsonpathfinder.com/
While I tried many paths to get the subscriberCount. The one below is one of the ones I used and cannot figure out how to get the value of it.
info.items[0].statistics.subscriberCount
JavaScript array indices start at 0
, therefore this website -- thinking you were trying to access the element in JavaScript -- gave you a zero-based array index.
However Lua array indices start at 1
, so the index is wrong.
Use array index 1
and everything should work fine.