简体   繁体   中英

Convert part of string to JSON for DataTables

I'm working with DataTables and Leaflet and want to show the data seen below on my screen with Datatables. I want to convert it to JSON minus the {....} part. How do I do this?

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]}, ;

I found a much more simple solution for my (bigger underlying) problem. I've used the following code to run through my GeoJSON array and return the data I needed.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM