I'm working with Highcharts that wants data in the following format and I'm having trouble achieving it:
var data = [
["CityName", 1234],
["City2", 12123]
]
etc...
So, I'm needing this formatted like the above array and simply can't seem to achieve it.
I've seen this from JSON.NET:
string[,] famousCouples = new string[,]
{
{ "Adam", "Eve" },
{ "Bonnie", "Clyde" },
{ "Donald", "Daisy" },
{ "Han", "Leia" }
};
string json = JsonConvert.SerializeObject(famousCouples, Formatting.Indented);
// [
// ["Adam", "Eve"],
// ["Bonnie", "Clyde"],
// ["Donald", "Daisy"],
// ["Han", "Leia"]
// ]
That's fine for strings, but how about string and a float together? This is a requirement as one of the numbers needs to aggregate over a list and string[,] really isn't an ideal object to work with.
At the minute I'm using List<Dictionary<string,float> (this would also be the result with a custom object) and the serializer is outputting data as:
var data = [
{"CityName", 1234}
]
etc.
I may be missing something really simple, but is there any way to achieve this?