gpt4 book ai didi

javascript - 为什么 JSON.stringify 返回未定义

转载 作者:行者123 更新时间:2023-11-30 07:34:20 25 4
gpt4 key购买 nike

<分区>

为什么 console.log(JSON.stringify(row.data)) 返回 undefined 以及如何修复它?

来自 https://jsfiddle.net/ys6j038q/3/

  var data = '{"data":{"time":"2016-08-08T15:13:19.605234Z","x":20,"y":30}}{"data":{"time":"2016-08-08T15:13:19.609522Z","x":30,"y":40}}';

var sanitized = '[' + data.replace(/}{/g, '},{') + ']';
var rows = JSON.parse(sanitized);
console.log(rows);

for(var row in rows){
console.log(JSON.stringify(row.data));
console.log(JSON.stringify(row.data));
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com