I have a model list of data to map chart. But the map chart accepts value format like this:
data: [{id: 'London', lat: 51.50, lon: -0.12}]
But the below code produce a data like this
The Id value is in double quote what I need is single quote 'London' and it should not display like that '"'. The sample chart with data can be found here https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/maps/demo/flight-routes/
Model
[JsonObject(MemberSerialization.OptIn)]
public class ShipmentLocationModel
{
[JsonProperty]
public string id { get; set; }
[JsonProperty]
public decimal lat { get; set; }
[JsonProperty]
public decimal lon { get; set; }
}
Controller
List<ShipmentLocationModel> LocationList = new List<ShipmentLocationModel>();
var stringWriter = new StringWriter();
var serializer = new JsonSerializer();
using (var writer = new JsonTextWriter(stringWriter))
{
writer.QuoteName = false;
serializer.Serialize(writer, LocationList);
}
ViewData["LocationList"] = stringWriter;
View
data: @ViewData["LocationList"]