This is the way how JavaScriptSerializer works. See these codes
string[,] info1 = new string[2,3]{{"string1","string2","string3"},
{"string4","string5","string6"}};
var json1 = new JavaScriptSerializer().Serialize(info1);
json => ["string1","string2","string3","string4","string5","string6"]
string[][] info2 = new string[][] { new[]{ "string1", "string2", "string3" },
new[]{ "string4", "string5", "string6" } };
var json2 = new JavaScriptSerializer().Serialize(info2);
json => [["string1","string2","string3"],["string4","string5","string6"]]
if you can't change the return type of the method GetInfo()
. I would suggest to use Json.Net
var json1 = JsonConvert.SerializeObject(info1);
It will return the json string as you expect.