I have this JSON and no matter what I try I can´t get any values from it. I don´t know what Im missing?
This is the json string.
{
"groups": [{
"name": "Credit Card",
"types": ["mc", "visa", "amex"]
}],
"paymentMethods": [{
"brands": ["mc", "visa", "amex"],
"details": [{
"key": "encryptedCardNumber",
"type": "cardToken"
}, {
"key": "encryptedSecurityCode",
"type": "cardToken"
}, {
"key": "encryptedExpiryMonth",
"type": "cardToken"
}, {
"key": "encryptedExpiryYear",
"type": "cardToken"
}, {
"key": "holderName",
"optional": true,
"type": "text"
}],
"name": "Card",
"type": "scheme"
}, {
"name": "Få först. Betala sen med Klarna.",
"supportsRecurring": true,
"type": "klarna"
}, {
"name": "Trustly",
"supportsRecurring": true,
"type": "trustly"
}, {
"name": "Swish",
"supportsRecurring": true,
"type": "swish"
}, {
"name": "Paysafecard",
"supportsRecurring": true,
"type": "paysafecard"
}, {
"name": "Dela upp med Klarna.",
"supportsRecurring": true,
"type": "klarna_account"
}, {
"name": "Pay now with Klarna.",
"supportsRecurring": true,
"type": "klarna_paynow"
}]
}
And then I try to get one single value(the "Credit Card") and also loop through all the paymetsMethods.details.key values and then loop all the last "name".
<!--#include file="aspJSON1.17.asp" -->
jsonstring = CStr(objXmlHttp.ResponseText)
'response.write "---"&jsonstring &"---"
Set oJSON = New aspJSON
oJSON.loadJSON(jsonstring)
groupsname=oJSON.data("groups").item("name")
response.write groupsname
For Each x In oJSON.data("paymentMethods").item("details")
paymentMethods=oJSON.data("paymentMethods").item("details").item("key")
response.write paymentMethods
NEXT
For Each x In oJSON.data("name")
thename=oJSON.data.item("name")
response.write thename
NEXT
Im clearly missing something, but what?