Ane'x Bm Ane'x Bm - 1 year ago 91
JSON Question

jsonArray not showing (web service)

Methode in web Service

Methode :

[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public void GetList()
JavaScriptSerializer ser = new JavaScriptSerializer();

Test[] test=new Test[3];
test[0] = new Test("1", "anex");
test[1] = new Test("2", "Ahmed");
test[2] = new Test("3", "Karim");

var json = new
list=test ,


Result :

List not showing !!

Answer Source

The Test class does contain private fields only. Therefore the JavaScriptSerializer will ignore them. Declare them as public an they will show up in the produced JSON.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download