2015-04-16 2 views
0

Я хочу, чтобы получить этот JSON ответ без строки узла в ASP.net WebService.Как удалить строку из узла ответа JSon

<string xmlns="http://tempuri.org/"> 
[{"bookname":"Love Stories","name":"Vave Microtech","email":"[email protected]","mobile":"918010066285","address":"Sushant tower sec-56, Gurgaon (India)","nearestarea":"gurgaon"},] 
</string> 
+0

Как вы обрабатываете результаты? – Drakes

ответ

1

Просто измените метод тип возвращаемого к аннулированию и написать строку с response.write() способом, как это.

[WebMethod] 
[ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
public void TestMethod() 
{ 
    // your actual Json 
    string srtJson="[{\"bookname\":\"Love Stories\"}]"; 

    HttpContext.Current.Response.ContentType = "text/HTML"; 
    HttpContext.Current.Response.Write(srtJson); 


} 
+0

Спасибо, что решает мою проблему. –

+0

HttpContext.Current.Response.ContentType = "text/xml"; – Realbitt

Смежные вопросы