我需要用 javascript 解析这个 json
{
"MasterProducts": {
"MasterProduct": [
{
"Productcode": "0903-000192",
"Description": "ICROCOMPUTER;32FX200 24BIT QFP 132P",
"ThumbPic": "NoImage.png",
"RRP": "41.400000",
"Stock": "0"
},
{
"Productcode": "0160-030",
"Description": "AXIS MPEG-4 Decoder 50-user licence pack onto 50 separate computers. For all Axis MPEG-4 products that do not support AAC audio encoding. (210 211 210A 211A 213 214 221 225FD 231D+ 232D+ 241S 241Q 241SA 241QA 242SIV 243SA 282 282A).",
"ThumbPic": "NoImage.png",
"RRP": "35.230000",
"Stock": "0"
},
{
"Productcode": "0160-040",
"Description": "AXIS MPEG-4 +ACC Decoder 50-user license onto 50 separate computers. For all Axis products that supports MPEG-4. (207 207W 207MW 212PTZ 216FD 223M).",
"ThumbPic": "NoImage.png",
"RRP": "50.880000",
"Stock": "0"
},
{
"Productcode": "10403E",
"Description": "Hotsync palm computer cradle/docking station",
"ThumbPic": "NoImage.png",
"RRP": "0.000000",
"Stock": "2"
},
{
"Productcode": "0903-000193",
"Description": "ICROCOMPUTER;32FX200 24BIT QFP 132P",
"ThumbPic": "NoImage.png",
"RRP": "37.790000",
"Stock": "0"
}
]
}
}
当这段代码只有一个结果时,我已经设法做到了
if(data !== '')
{
xmlData = data.childNodes[0].childNodes[0].data;
objData = app.XML2OBJ(xmlData);
var item = objData.MasterProduct.Description;
//alert(item);
}
但不能让它与多组结果一起工作。