[{ "call_time": "0", "total_inc_traffic": "1363.10", "total_out_traffic": "88.70"}, { "call_time": "1", "total_inc_traffic": "479.57", "total_out_traffic": "36.98"}, { "call_time": "2", "total_inc_traffic": "239.57", "total_out_traffic": "13.43"}, { "call_time": "3", "total_inc_traffic": "190.28", "total_out_traffic": "8.20"}, { "call_time": "4", "total_inc_traffic": "223.80", "total_out_traffic": "0.00"}, { "call_time": "5", "total_inc_traffic": "158.87", "total_out_traffic": "19.58"}]这是我想要将所有“total_inc_traffic”输出的输出作为的网址{1363.10,479.57,239.57,190.28,158.87}如何使用json获取此输出?
1 回答
慕码人8056858
TA贡献1803条经验 获得超6个赞
您可以使用Array.map和Number
let arr = [{ "call_time": "0", "total_inc_traffic": "1363.10", "total_out_traffic": "88.70" }, { "call_time": "1", "total_inc_traffic": "479.57", "total_out_traffic": "36.98" }, { "call_time": "2", "total_inc_traffic": "239.57", "total_out_traffic": "13.43" }, { "call_time": "3", "total_inc_traffic": "190.28", "total_out_traffic": "8.20" }, { "call_time": "4", "total_inc_traffic": "223.80", "total_out_traffic": "0.00" }, { "call_time": "5", "total_inc_traffic": "158.87", "total_out_traffic": "19.58" }];
let result = arr.map(v => Number(v.total_inc_traffic));
console.log(result);
- 1 回答
- 0 关注
- 213 浏览
添加回答
举报
0/150
提交
取消