You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
For Each custom_id In oJSON.data("purchase_units")
Set this = oJSON.data("purchase_units").item(custom_id)
Response.Write _
this.item("custom_id")
Next
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")
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:
The text was updated successfully, but these errors were encountered: