gpt4 book ai didi

javascript - 如何将 dist.js 转换为 Json

转载 作者:行者123 更新时间:2023-11-28 02:38:13 24 4
gpt4 key购买 nike

这是我的 dist.js 文件:

var dist = [
['town1', [], []],
['town2', [271], ['10h30m']],
['town3', [93,178], ['3h26m','7h04m']],
['town4', [342,71,245], ['13h24m','2h30m','9h29m']],
...

将其放入 json 的格式是什么? (与城镇的距离和时间)请帮忙。谢谢

最佳答案

这可能就是您想要的:

var dist = [[
"town1",
[271],
['10h30m']
],[
"town2",
...
]];
var output = JSON.stringify(dist); //"ouptput" is containing
//your array in JSON format

演示:http://jsfiddle.net/DerekL/zddME/

关于javascript - 如何将 dist.js 转换为 Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13104481/

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