{
"b":
[{"userName":"爸爸","tel":"123456"},{"userName":"妈妈","tel":"123456"}],
"c":
[{"userName":"陈总","tel":"123456"},{"userName":"成刚","tel":"123456"}],
"d":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"e":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"f":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}]
}
在jsp中用$.each()来遍历下
或者其他的方法
"b":
[{"userName":"爸爸","tel":"123456"},{"userName":"妈妈","tel":"123456"}],
"c":
[{"userName":"陈总","tel":"123456"},{"userName":"成刚","tel":"123456"}],
"d":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"e":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"f":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}]
}
在jsp中用$.each()来遍历下
或者其他的方法
"b":
[{"userName":"爸爸","tel":"123456"},{"userName":"妈妈","tel":"123456"}],
"c":
[{"userName":"陈总","tel":"123456"},{"userName":"成刚","tel":"123456"}],
"d":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"e":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"f":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}]
}在jsp中用$.each()来遍历下
或者其他的方法
var obj = {
"b":[{"userName":"爸爸","tel":"123456"},{"userName":"妈妈","tel":"123456"}],
"c":[{"userName":"陈总","tel":"123456"},{"userName":"成刚","tel":"123456"}],
"d":[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"e":[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"f":[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}]
}
function each(obj){
var toStringMethod = Object.prototype.toString;
var self = arguments.callee;
for(var p in obj){
if(obj.hasOwnProperty(p)){
var type = toStringMethod.call(obj[p]);
if(type=='[object Object]' || type == '[object Array]'){
self(obj[p]);
}else{
console.log(p+':'+obj[p]);
}
}
}
}
each(obj);
$(function(){
var data = {
"b":
[{"userName":"爸爸","tel":"123456"},{"userName":"妈妈","tel":"123456"}],
"c":
[{"userName":"陈总","tel":"123456"},{"userName":"成刚","tel":"123456"}],
"d":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"e":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}],
"f":
[{"userName":"123","tel":"123456"},{"userName":"123","tel":"123456"}]
};
$.each(data , function(){
$.each(this , function(){
alert(this.userName + " " + this.tel);
});
});
});