Open coda-apps opened 11 months ago
The attribute "purchase_units" contains an unnamed container, this is probably the place where you have problems. In case you expect only one purchase_unit, you can access the first item directly by index. Otherwise you would have to loop through the collection.
Dim objJSONData : Set objJSONData = objJSON.data
Dim objPurchaseUnits : Set objPurchaseUnits = objJSONData.item("purchase_units")
Dim objPurchaseUnit : Set objPurchaseUnit = objPurchaseUnits.item(0)
MsgBox objPurchaseUnit.item("custom_id")
The attribute "purchase_units" contains an unnamed container, this is probably the place where you have problems. In case you expect only one purchase_unit, you can access the first item directly by index. Otherwise you would have to loop through the collection.
Dim objJSONData : Set objJSONData = objJSON.data Dim objPurchaseUnits : Set objPurchaseUnits = objJSONData.item("purchase_units") Dim objPurchaseUnit : Set objPurchaseUnit = objPurchaseUnits.item(0) MsgBox objPurchaseUnit.item("custom_id")
Thank you
Hi there.
Thanks for setting up this git.
I have some sample code i am getting from paypal.
I would like to get the 'custom_id' variable (in: purchase_units) I tried
custom_id = oJSON.data("purchase_units").item("custom_id")
but it was empty. How would i access it? Is it different being within an array?I also tried this, which works partially - i get an error on what seems to be the 2nd loop of the
for
loop. But the first loop does seem to access the tag i want. Maybe its throwing an error as this isnt a true array with multiple objects?Thanks
JSON BELOW: