I try to get data in json format like this
[{month: 'July',data: [14]}, {month: 'June', data: [3]}, {month: 'May', data: [4] }]
I try this code
[WebMethod]
public static string summarydata()
{
try
{
TrackDataEntities1 sd = new TrackDataEntities1();
var data = new TrackDataEntities1().spsumdata()
.Select(s => new { month = s.Month, data = new int[] { s.data.Value } }).ToArray();
return Newtonsoft.Json.JsonConvert.SerializeObject(data);
}
catch (Exception)
{
throw new Exception();
}
}
When i check console data is like this
[{"month":"July","data":[14]},{"month":"June","data":[3]},{"month":"May","data":[4]}]
whereas i want like this
[{month: 'July',data: [14]}, {month: 'June', data: [3]}, {month: 'May', data: [4] }]