Why do I get an OutOfBoundsException when the JSONItem contains 2 objects?
[code] Dim data As String = DefineEncoding(content, Encodings.UTF8)
Dim jChild As new JSONItem(data)
Dim jNode As JSONItem
Dim msg As String
for i As Integer = 0 to jChild.Count-1
jNode = jChild.Child(i) <<---- OutOfBoundsException
msg = msg + “ID” + jNode.Value(“id”) + ", Email: " + jNode.Value(“email”) + Chr(13)
next
MsgBox msg[/code]
Response received from API (data String variable)
{
“object”: “list”,
“count”: 2,
“url”: “/v1/customers”,
“data”: [
{
“object”: “customer”,
“created”: 1389910508,
“id”: “cus_3K2UBxudhu8Hrt”,
“livemode”: false,
“description”: “Customer 1”,
“email”: “cust1@mydomain.com”,
“delinquent”: false,
“metadata”: {},
“subscription”: null,
“discount”: null,
“account_balance”: 0,
“currency”: null,
“cards”: {
“object”: “list”,
“count”: 0,
“url”: “/v1/customers/cus_3K2UBxudhu8Hrt/cards”,
“data”: []
},
“default_card”: null
},
{
“object”: “customer”,
“created”: 1389910386,
“id”: “cus_3K2S9rTs5KTs62”,
“livemode”: false,
“description”: “Customer 2”,
“email”: “cust2@mydomain.com”,
“delinquent”: false,
“metadata”: {},
“subscription”: null,
“discount”: null,
“account_balance”: 0,
“currency”: null,
“cards”: {
“object”: “list”,
“count”: 0,
“url”: “/v1/customers/cus_3K2S9rTs5KTs62/cards”,
“data”: []
},
“default_card”: null
}
]
}