【发布时间】:2016-03-30 12:31:07
【问题描述】:
我正在使用 DataTables 和 Leaflet,并希望使用 Datatables 在我的屏幕上显示下面看到的数据。我想将它转换为 JSON 减去 {....} 部分。我该怎么做?
1, 9.12345678912345, 22.123456789132345, AAAAAAA, XXX, {"type":"Point","coordinates":[6.557876,53.456783]}, ;
2, 6.12345678912345, 41.216375999999997, BBBBBBB, YYY, {"type":"Point","coordinates":[6.531819,53.216376]}, ;
3, 4.12345678912345, 90.213718123465500, CCCCCCC, ZZZ, {"type":"Point","coordinates":[6.510978,53.213718]}, ;
【问题讨论】:
-
从输出中排除对象类型的条件会怎样?
-
您希望数据在 JSON 中是什么样子?
{...}部分是目前唯一的 JSON 部分。如果这些行只是字符串,您可以使用正则表达式匹配所有行直到{字符? -
我对 JSON 等很陌生,但我认为它应该看起来像
var test = [ {"id": 1, "x": 9.12345678912345, "y": 22.123456789132345, "brand": "AAAAAAA", "name": "XXX"},......... ];
标签: javascript jquery json datatables leaflet