I am looking to convert the below SQL results into a JSON list for a Highcharts line chart. I am using C#. I cant get my head around how I would create an appropriate class(es) and populate them with this data in the format needed.
ID Name Month Year Data
2 Name 1 10 2015 4
2 Name 1 11 2015 5
2 Name 1 12 2015 6
3 Name 2 10 2015 6
3 Name 2 11 2015 7
3 Name 2 12 2015 8
4 Name 3 10 2015 35
4 Name 3 11 2015 7
4 Name 3 12 2015 8
The end result needs to be in something like this format. The ID and year also need to come through but are used for different things. Can this be done?
categories: ['10', '11', '12'],....
series: [{
name: 'Name 1',
data: [4, 5, 6]
}, {
name: 'Name 2',
data: [6, 7, 8]
}, {
name: 'Name 3',
data: [35, 7, 8]
}
}]