日期:2014-05-16  浏览次数:20377 次

这个json我怎么也遍历不明白,求解?
求以下json的遍历方法,感谢!!!

var carData={"'34'":{"name":"A \u963f\u65af\u987f\u00b7\u9a6c\u4e01"
,"brand":{"'61'":{"name":"\u963f\u65af\u987f\u00b7\u9a6c\u4e01"
,"pserise":{"'298'":{"name":"Rapide","import":"2","model":{"'11563'":"Rapide 6.0L S","'5290'":"Rapide 6.0L"}},"'299'":{"name":"V12 Vantage","import":"2"
,"model":{"'11446'":"V12 Vantage 6.0L S","'8947'":"V12 Vantage 6.0 Roadster","'5291'":"V12 Vantage 6.0 Manual Coupe"}},"'629'":{"name":"V12 Zagato","import":"2"
,"model":{"'9037'":"V12 Zagato 6.0L"}},"'300'":{"name":"V8 Vantage","import":"2"
,"model":{"'5292'":"V8 Vantage 4.7 S Coupe","'5293'":"V8 Vantage 4.7 S Roadster","'5294'":"V8 Vantage 4.7 Sportshift Coupe","'5295'":"V8 Vantage 4.7 Sportshift Roadster"}},"'643'":{"name":"Vanquish","import":"2","model":{"'9057'":"Vanquish 6.0 \u57fa\u672c\u578b"}},"'301'":{"name":"Virage","import":"2"
,"model":{"'5301'":"Virage 6.0 Coupe","'5302'":"Virage 6.0 Volante"}},
"'302'":{"name":"\u963f\u65af\u987f\u9a6c\u4e01DB9","import":"2"
,"model":{"'10244'":"\u963f\u65af\u987f\u9a6c\u4e01DB9 6.0L Coupe"}}
,"'303'":{"name":"\u963f\u65af\u987f\u9a6c\u4e01DBS","import":"2"
,"model":{"'5311'":"\u963f\u65af\u987f\u9a6c\u4e01DBS 6.0 Touchtronic Coupe","'5312'":"\u963f\u65af\u987f\u9a6c\u4e01DBS 6.0 Manual Volante","'5313'":"\u963f\u65af\u987f\u9a6c\u4e01DBS 6.0 Touchtronic Volante","'5314'":"\u963f\u65af\u987f\u9a6c\u4e01DBS 6.0 Manual Coupe"}}}}}}}

------解决方案--------------------
用for in 来遍历
for(var name in carData) {
    alert(name+":"+carData[name]);
}
------解决方案--------------------

var carData = {
            "'34'": {
                "name": "A 阿斯顿·马丁",
                "brand": {
                    "'61'": {