Мой JSON упакован в xml, когда возвращается веб-службой asmx?
К сожалению, клиент поддерживает только VS 2008 (framework 3.5), не зная, почему мой json упакован в xml. Использование веб-форм.
Мой JSON вернулся:
<?xmlversion="1.0"encoding="utf-8"?><stringxmlns="http://tempuri.org/">[
{
"Name": "AAA",
"Company": "AAAA",
"Address": "AAAA",
"Phone": "1204675",
"Country": "US"
},
{
"Name": "AAAA",
"Company": "AAAA",
"Address": "AAAA",
"Phone": "AAA",
"Country": "AAA"
}
]</string>
Мой код ASMX:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class HCTCService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string TestJSON()
{
Employee[] e = new Employee[2];
e[0] = new Employee();
e[0].Name = "AAA";
e[0].Company = "AAAA";
e[0].Address = "AAAA";
e[0].Phone = "1204675";
e[0].Country = "US";
e[1] = new Employee();
e[1].Name = "AAAA";
e[1].Company = "AAAA";
e[1].Address = "AAAA";
e[1].Phone = "AAA";
e[1].Country = "AAA";
return new JavaScriptSerializer().Serialize(e);
}
}
}