将字符串的一部分转换为DataTables的JSON

Convert part of string to JSON for DataTables

本文关键字:DataTables JSON 一部分 字符串 转换      更新时间:2023-09-26

我正在使用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]}, ;

我为我的(更大的底层)问题找到了一个更简单的解决方案。我已经使用以下代码来运行我的GeoJSON数组并返回我需要的数据。

geojson.features.map(function(row) { return row.properties; })