我以這種格式將一個httpwebresponse流視爲一個字符串。來自http web響應流的解析值
{"totalUsersCount":
[{"AccountStatus":1,"TotalUsers":53,"MemberUsers":33,"CrimsonUsers":20},
{"AccountStatus":2,"TotalUsers":7,"MemberUsers":7,"CrimsonUsers":0},
{"AccountStatus":3,"TotalUsers":44,"MemberUsers":37,"CrimsonUsers":7},
{"AccountStatus":6,"TotalUsers":28718,"MemberUsers":28718,"CrimsonUsers":0},
{"AccountStatus":5,"TotalUsers":3,"MemberUsers":3,"CrimsonUsers":0}]}
我想單獨解析出totalUsersCount的價值,使我得到的分析出結果以這種格式
[{"AccountStatus":1,"TotalUsers":53,"MemberUsers":33,"CrimsonUsers":20},
{"AccountStatus":2,"TotalUsers":7,"MemberUsers":7,"CrimsonUsers":0},
{"AccountStatus":3,"TotalUsers":44,"MemberUsers":37,"CrimsonUsers":7},
{"AccountStatus":6,"TotalUsers":28718,"MemberUsers":28718,"CrimsonUsers":0},
{"AccountStatus":5,"TotalUsers":3,"MemberUsers":3,"CrimsonUsers":0}]
如果結果是JSON格式,我們可以很容易地解析出來。但是這個結果是以字符串格式。我試圖使用Json.parse對字符串進行json化,然後應用json解析。但是這並沒有幫助。可能是我沒有嘗試正確的方式。誰能幫忙?
** **怎麼沒有幫助?發生了什麼?你寫了什麼代碼? – SLaks
http://james.newtonking.com/json/help/index.html?topic=html/Samples.htm# –