I'm struggling around a wired JSON Problem. I'm working with ASP C# and have a View sending a JS-Array to a Controller Action.
Here is the Structure of the JSON Data.
public class MapData
{
public List<Point> Points { get; set; }
}
public class Point
{
public string lat { get; set; }
public string lng { get; set; }
}
Here's the Routine I use to generate the JSON Array: for test purposes it doesn't generate valid MapData.
$("#pac-save").click(function () {
var mapPoints = {
Points: []
}
mapPoints.Points.push({
lat:"asdf1",
lng:"asdf1"
})
mapPoints.Points.push({
lat:"asdf2",
lng:"asdf2"
})
$.ajax({
url: "/Map/saveGeplanteRoute",
data:mapPoints
}).done(function (dd) {
alert("done");
}).fail(function () {
alert("error");
});
})
Here's the Controller Action
public JsonResult saveGeplanteRoute(MapData data)
{
var test = new MapData
{
Points = new List<Point>()
};
test.Points.Add(new Point() { lat = "asdf1", lng = "asdf1" });
test.Points.Add(new Point() { lat = "asdf2", lng = "asdf2" });
return Json(test);
}
The weird thing: When I stringify the data before sending it, it looks like this:
"{"Points":[{"lat":"asdf1","lng":"asdf1"},{"lat":"asdf2","lng":"asdf2"}]}"
The data coming back from Controller looks exactly the same when I stringify it: Why can't C# parse the Point data? The amount of point data is right as you can see below:
I'll be glad on some advice pointing me to an error I did not found

Pointclass look like?