【发布时间】:2012-06-29 08:35:17
【问题描述】:
我遇到了从 .ASMX 返回的 Json 格式问题
我需要返回这样的东西
[{ name : "TEST1", data : [100]},
{ name : "TEST2", data : [200]}]
这是我的示例
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public List<jsonGraphSeries> Graph(string ID)
{
List<GenList>objGenList = new List<GenList>();
GenList objlist;
objlist = new GenList();
objList.name = "TEST";
objList.data[0] = 100;
objGenList.add(objList);
}
public class GenList
{
public string name;
public double[] data;
}
什么也没发生...有人可以帮我解决这个问题吗?
【问题讨论】:
-
您确定这是一个 HTTP POST 请求吗?看到这个:stackoverflow.com/questions/211348/…
-
我只想制作一个json w/c 可以以这种格式输出
标签: asp.net asmx highcharts webmethod