var data='{"0":{"name":1,"value":"1"},"1":{"name":2,"value":"2"},"2":{"name":3,"value":"3"},"6":{"name":4,"value":"4"}}';
var result = JSON.parse(data);
var typeofResult = typeof result;
var method1_result = method2_result = [];
if(typeofResult == 'object'){
//first 开始使用的方法
method1_result = $.map(result, function(el,index) { return el; });
//目前项目使用的方法
for(var index in result){
if (result.hasOwnProperty(index)) {
method2_result[index] = result[index];
}
}
}
console.log(method1_result);
console.log(method2_result);
External resources loaded into this fiddle: