for(var key in json.res){ var json2 = json.res[key]; if (key=="合计") { var arr_ = [key]; for(var key2 in json2){ if(table_head_state){ table_head.push(key2); } arr_.push(json2[key2]); } table_head_total = arr_; } else { var arr = [key]; for(var key2 in json2){ if(table_head_state){ table_head.push(key2); } arr.push(json2[key2]); } table_body[table_body_i] = arr; table_body_i++; } table_head_state = false; }
数组的方法,下次一定要记得好好对得到的数据进行分析,