0
我正在尝试将我们的ERP系统集成到我们的网站中。我能够从系统中获得一些json响应。但我真的需要一些帮助解析它。解析经典ASP中的json
我使用ASPJSON(www.aspjson.com)来帮助我。
问题是如何从“数据”中获取所有字段。我能够获得DebtorId,但我无法弄清楚如何获得其他。
JSON响应:
"Data":{"DebtorId":1,"Data":
[{"Id":"Felt01","Label":"Navn","Value":"Testmedlem"},
{"Id":"Felt14","Label":"Bemærkninger","Value":""},
{"Id":"Felt15","Label":"Oprettet den","Value":null},
{"Id":"Felt16","Label":"Sidst rettet","Value":"2015-12-04T22:56:36"},
{"Id":"Felt23","Label":"Udmeldt","Value":null},
{"Id":"Felt12","Label":"Note","Value":""},
{"Id":"Felt02","Label":"Adresse 1","Value":"Adresse 1"},
{"Id":"Felt03","Label":"Postnr","Value":""},
{"Id":"Felt04","Label":"Bynavn","Value":""},
{"Id":"Felt05","Label":"Mobiltelefon","Value":""},
{"Id":"Felt06","Label":"Adresse 2","Value":""},
{"Id":"Felt07","Label":"Telefon","Value":""},
{"Id":"Felt08","Label":"Efternavn","Value":""},
{"Id":"Felt10","Label":"Email","Value":""},
{"Id":"Felt24","Label":"Aktiv","Value":false},
{"Id":"Felt09","Label":"Grupper og roller","Value":[]},
{"Id":"Felt11","Label":"Medlemskontingent","Value":0},
{"Id":"Felt13","Label":"Medarbejdernr","Value":""},
{"Id":"Felt17","Label":"Ansættelsessted","Value":{"Id":0,"Code":null,"Value":null}},
{"Id":"Felt18","Label":"Land","Value":""},
{"Id":"Felt19","Label":"Medlemsnummer","Value":1},
{"Id":"Felt20","Label":"Donation","Value":0.0},
{"Id":"Felt21","Label":"WebID","Value":0}]},
"WinkasErrorCode":0,"WinKasStatus":0,"WinKasStatusString":"Okay",
"WinKasMessage":null,"ApiVersion":"1.1.888.91",
"ResponseDateTime":"2015-12-04T23:23:19"
传统的ASP:
Response.Write "<p>Result (single):" & requestBody.data("DebtorId").item(phonenr) & "</p>"
For Each phonenr In requestBody.Data
Set this = requestBody.data("Data").item(Id)
Response.Write _
this.item("type") & ": " & _
this.item("number") & "<br>"
Next
关于在经典中使用JSON有几个问题ASP。我发现它更容易使用(服务器端)Javascript而不是VBScript作为脚本语言而不是像ASPJSON这样的类,请参阅我的答案 - http://stackoverflow.com/questions/30538292/asp-json-object-not-a -collection/30546374#30546374 – John