我正在尝试从 C# 中 Windows CE 6 上的 CakePHP Web 服务解码 JSON。JSON 的一个示例是:
"{
"response":
[
{
"Asset":
{
"name":"La Riviera","assetnumber":"16151","assettype":"Art","assignedlocation":"HOUSTON","currentlocation":"HOUSTON","properties":
{
"Tag ID":"2331221","Last Seen":"","Status":"MISSING","Sold":"0","Layaway":"0","Artist":"Corbiere","Size":"80x80 cm","Calibration Date":""
}
}
},
{
"Asset":
{
"name":"Port de Centuri-edit","assetnumber":"16150","assettype":"Art","assignedlocation":"HOUSTON","currentlocation":"HOUSTON","properties":
{
"Tag ID":"3741923","Last Seen":"","Status":"MISSING","Sold":"1","Layaway":"0","Artist":"Corbiere","Size":"80x80 cm","Calibration Date":"2013-01-12"
}
}
}
]
}"
我想把它变成一个类似字典的对象,也许是字典,这样它就可以像
string name = json["response"][0]["Asset"]["name"];
我可以使用 JSON.net 的 LINQ JObject 类和 JObject.Parse 在 PC 上执行此操作,但是这些似乎不适用于 CE。对可以做到这一点的图书馆有什么建议吗?我宁愿不必为每种情况构建特定的 JSON 类。