0

I am trying to create a .json file from a string of coordinates to display. I can get to the point of creating the file but the JSON Is not correct. Code follows

json="10,10;10,5;5,5;5,10"
 List<Coords> eList = new List<Coords>();
                Coords d = new Coords();
                d.type = "Polygon";
                d.coordinates = Newtonsoft.Json.JsonConvert.DeserializeObject(json);


                List<def> deflist = new List<def>();
                def f = new def();
                f.type = "GeometryCollection";
                f.geometries = d;
THE RESULTS ARE

        {
          "type": "GeometryCollection",
          "geometries": {
            "type": "Polygon",
            "coordinates": [
              [
                [
                  10,
                  10
                ],
                [
                  10,
                  5
                ],
                [
                  5,
                  5
                ],
                [
                  5,
                  10
                ]
              ]
            ]
          }
        }

    -- SHOULD LOOK LIKE THIS

    {
      "type": "GeometryCollection",
      "geometries": {
        "type": "Polygon",
        "coordinates": [
          [[10,10],[10,5],[5,5],[5,10]]
        ]
      }
    }

the coordinates are indented and formatted in a way I can't understand. Any suggestions would be greatly appreciated.

The File is being generated to be used with Telerik RadMap Control.

2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.