score:4

Accepted answer
const data = [{
    "geometry": {
        "type": "Polygon",
        "coordinates": "[\"0|55.852081917669,11.704305226785\",\"1|55.851551628025,11.706345689048\",\"2|55.853209224226,11.712709159294\",\"3|55.851748029256,11.713342357427\",\"4|55.845937703792,11.720414588428\",\"5|55.845051483877,11.713738293486\",\"6|55.846069367192,11.711604417263\",\"7|55.846239161586,11.71001852885\",\"8|55.845765045803,11.709506210798\",\"9|55.844532089093,11.709164766166\",\"10|55.84419438921,11.705722332566\",\"11|55.847328748169,11.704214635447\",\"12|55.848990718611,11.703850761782\",\"13|55.850086606046,11.704294408103\",\"14|55.850086606046,11.704294408103\"]"
    },
    "properties": {
        "title": "Area 1",
        "slug": "area-1"
    }
}];

const polygonareas = data.map(area => ({
  geometry: {
    type: "Polygon",
    coordinates: JSON.parse(area.geometry.coordinates)
  },
  properties: {
    title: area.properties.title,
    slug: area.properties.slug
  }
}));

console.log(polygonareas);

score:0

{
"type": "FeatureCollection",
"features": [
    {
        "geometry": {
            "type": "Polygon",
            "coordinates": [
                "55.7091,11.842046",
                "55.708983,11.841894",
                "55.708738,11.84157"
            ]
        },
        "properties": {
            "title": "Area 2",
            "slug": "area-2"
        }
    }
 ]
}

Related Query

More Query from same tag