level 5
天下无双之武魂
楼主
var json = {
"category" : [
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
},
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
},
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
}
],
"sleeve": ["长","短","无","中/七分"],
"detail": ["蝴蝶结","蕾丝花边","绣花","荷叶边","纽扣装饰","钉珠装饰","印花","铆钉"],
"style" : ["淑女","欧美","瑞丽","休闲","日式","OL通勤","名族风","百搭","甜美","英伦风","其它风格"],
"design" : ["纯色","花色","格子","形状","圆点","条纹","手绘","卡通","豹纹","千鸟格","字母","动物","其它图案"],
"material" : ["纯棉","雪纺","牛仔布","灯芯绒","蕾丝","皮质","棉纶","真丝","羊绒","羊毛","绸缎","其它"],
"season" : ["春季款","夏季款","秋季款","冬季款"],
"waist" : ["高腰","中腰","低腰","超低腰","松紧摇","宽松腰"],
"size" : ["常规","超短","中长(及膝)","超长(过膝)"],
"year" : ["2011"],
"user_level" : ["普通会员","VIP会员","金牌VIP"]
};
function print(e){
var sp = (arguments[1]||**) + * *;
//Object.prototype.toString.call()用于识别数组类型,而typeof不能区分array和object
if(typeof(e) == *object* && Object.prototype.toString.call(e) === *[object Array]*)
document.write(*[* + *<br />*);
else
document.write(*{* + *<br />*);
for(var i in e){
if(typeof(e[i]) == *object*){
document.write(sp + i + *(*+ (Object.prototype.toString.call(e[i]) === *[object Array]*?*array*:typeof(e[i])) +*) => *);
print(e[i], sp);
}else{
document.write(sp + i + *(*+ (Object.prototype.toString.call(e[i]) === *[object Array]*?*array*:typeof(e[i])) +*) => * + e[i] + *<br />*);
}
}
if(typeof(e) == *object* && Object.prototype.toString.call(e) === *[object Array]*)
document.write(sp.substr(0, sp.length - 18) + *]* + *<br />*);
else
document.write(sp.substr(0, sp.length - 18) + *}* + *<br />*);
}
print(json);
2014年09月02日 02点09分
1
"category" : [
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
},
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
},
{
"coat" : ["长袖T恤","短袖T恤","宽松衬衣","合体衬衣","外套","马夹"],
"pants" : ["七分裤","九分裤","长裤","短裤"],
"skirt" : ["连衣裙","短裙","长裙","吊带裙"]
}
],
"sleeve": ["长","短","无","中/七分"],
"detail": ["蝴蝶结","蕾丝花边","绣花","荷叶边","纽扣装饰","钉珠装饰","印花","铆钉"],
"style" : ["淑女","欧美","瑞丽","休闲","日式","OL通勤","名族风","百搭","甜美","英伦风","其它风格"],
"design" : ["纯色","花色","格子","形状","圆点","条纹","手绘","卡通","豹纹","千鸟格","字母","动物","其它图案"],
"material" : ["纯棉","雪纺","牛仔布","灯芯绒","蕾丝","皮质","棉纶","真丝","羊绒","羊毛","绸缎","其它"],
"season" : ["春季款","夏季款","秋季款","冬季款"],
"waist" : ["高腰","中腰","低腰","超低腰","松紧摇","宽松腰"],
"size" : ["常规","超短","中长(及膝)","超长(过膝)"],
"year" : ["2011"],
"user_level" : ["普通会员","VIP会员","金牌VIP"]
};
function print(e){
var sp = (arguments[1]||**) + * *;
//Object.prototype.toString.call()用于识别数组类型,而typeof不能区分array和object
if(typeof(e) == *object* && Object.prototype.toString.call(e) === *[object Array]*)
document.write(*[* + *<br />*);
else
document.write(*{* + *<br />*);
for(var i in e){
if(typeof(e[i]) == *object*){
document.write(sp + i + *(*+ (Object.prototype.toString.call(e[i]) === *[object Array]*?*array*:typeof(e[i])) +*) => *);
print(e[i], sp);
}else{
document.write(sp + i + *(*+ (Object.prototype.toString.call(e[i]) === *[object Array]*?*array*:typeof(e[i])) +*) => * + e[i] + *<br />*);
}
}
if(typeof(e) == *object* && Object.prototype.toString.call(e) === *[object Array]*)
document.write(sp.substr(0, sp.length - 18) + *]* + *<br />*);
else
document.write(sp.substr(0, sp.length - 18) + *}* + *<br />*);
}
print(json);