scropio gurl

scropio gurl

  • NA
  • 147
  • 96.9k

JSON array data format

Jul 14 2016 8:09 AM
I have web method in this we method i try to return JSON array and then i use this GetVo in jquery
[WebMethod]
public static string GetVo(DateTime fdate, DateTime tdate, string region)
{
string data2 = "[";
try
{
T1 DB = new T1();
//here is LINQ query which is long so i did not paste
e.g. var rea=from ......... .tolist();
data2 += rea.ToList().Select(x => "['" + x.Name + "'," + x.cnt + "]")
.Aggregate((a, b) => a + "," + b);
data2 += "]";
}
catch (Exception)
{
throw new Exception();
}
return data2;
}
this return me data like this
[['DDSB',39],['DPSB',9],['DSB',26],['MV',35],['PSB',52]]
but i want like this
[["DDSB",39],["DPSB",9],["DSB",26],["MV",35],["PSB",52]]
how i do this
any solution?

Answers (2)