我想創建Android客戶端應用程序,它使用來自asp.net服務器應用程序的基於asmx web服務的JSON。我的服務器代碼返回JSON fromat結果。我試圖從Internet.It的示例代碼convenient.But用我自己的服務器應用程序(「http://stockcluster.com/CurrentPeriod.asmx/GetGrowthPersentage」)下面的錯誤出現,而不是JSON對象:無法轉換爲JSON對象android
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title>
<script src="http://ak2.imgaft.com/script/jquery-1.3.1.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
jQuery.ajax({ url: 'https://mcc.godaddy.com/parked/park.aspx/?q=pFHmpJMaLaO4pUybMzqlMF5j
LabyZwMzqaRyZ3RlAwt0ZGN3ZPHlAzA2pFHmpGRmAmN2BGRkBQp0AGp0AwHmAQDyZwMyMlHmpG
VjZGZkZQN3ZQZ0AmZlWGV2L3xyZ3Rk-1', dataType: 'jsonp', type: 'GET', jsonpCallback: 'parkcallback',
success: function (data) { if (data["returnval"] != null) { window.location.href = 'http://stockcluster.com?nr=' + data["returnval"]; }
else { window.location.href = 'http://stockcluster.com?hg=0' } }});});
</script></head><body></body></html>
Value <html of type java.lang.String cannot be converted to JSONObject
請給我一些建議。
編輯: 我的服務器代碼是在這裏:
[WebMethod]
public void HelloWorld() {
String j = "Hello World";
Context.Response.Write(JsonConvert.SerializeObject(new { j }));
}
輸出JSON是在這裏:
{"j":"Hello World"}
你能提供任何服務器端的代碼呢?這是沒有JSON。 –
我編輯我的問題。 – Monlay