最近在做一個springboot的前置服務調用c#.net的webservice,接口返回的是json字符串,發現.net 的webservice返回的數據在數據的外層都會包含一層xml的定義,而我只想要裏面的json字符串。
最後的解決方法:
1、接口返回的數據格式爲void,無返回值
2、使用Context.Response.Write來進行數據的返回,注意後面一定要加上Response.End()
Context.Response.Write(HttpUtility.UrlEncode(encystring));
Context.Response.End();
3、然後就可以使用json轉換各種對象了