0
我有一個json對象(從java Object1創建) 包含Object2列表的問題... 我無法訪問列表中的對象2的值object1 ..json對象訪問屬性問題
JSON對象是
{
"object": {
"idItemGroup": "45",
"path": "1",
"dealer": "6",
"refIdMacroItemGroup": "6",
"description": "kb4",
"price": "5.5",
"qty": "1",
"itms": {
"@class": "list",
"ecomm.datamodel.ItemModify": [
{
"isDeleted": "false",
"isAdded": "false",
"idItem": "14",
"idLabel": "10029",
"label": "kb3",
"price": "5.5",
"dealer": "6",
"refItemGroup": "45"
},
{
"isDeleted": "false",
"isAdded": "false",
"idItem": "12",
"idLabel": "10025",
"label": "kc1",
"price": "5.5",
"dealer": "6",
"refItemGroup": "45"
}
]
}
}
}
但JS我只能得到ITMS的對象? 在此先感謝。
jsonObject.object.description(KB4)
我怎麼能得到idLabel的值
真的謝了,我發現還有另一種解決方案(因爲它不僅是JavaScript,但有一個java類使用Xstream(com.thoughtworks.xstream.XStream)序列化到JSON的對象... 所以解決方案是 xstream.alias( 「ITEMMODIFY」,ecomm.datamodel.ItemModify.class); 然後 訪問 jsonObject.object.ITEMMODIFY.properties :) 也真的感謝! – Vito 2010-02-19 18:14:35