簡體   English   中英

JSON服務字符串錯誤無法轉換為JSONObject

[英]Error for json Service String cannot be converted to JSONObject

我已經嘗試了所有方法,但仍然給我同樣的錯誤。在網站上實施SSL之前,一切工作都很好。 這是我的服務“ 我的清單”的網址。 錯誤是價值時代,但找不到任何東西

你可以這樣嘗試

if (json.getString(itfdata) != null ) {


                    String itfdata = json.getString("itfdata");
                    Log.d("Json Response itfdata is--->","" + itfdata.toString());

            }


    try {
                JSONArray array = new JSONArray(itfdata.toString());
                //JSONArray array = new JSONArray(itfdata.toString());

                for (int i = 0; i < array.length(); i++) {
                    list.add(array.getString(i));
                    System.out.println("I Position : " + array.getString(i));

                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

確保您的地址包含https否則您將得到302 Found ,告訴您重定向到https endpoing。

您的網址應為:

https://www.fitindya.in/windex.php?itfpage=cat_post&id=5

並不是

http://www.fitindya.in/windex.php?itfpage=cat_post&id=5

例如,您可以做的是

String strUrl = getUrlData.replace("http://","https://")+"windex.php?itfpage=cat_post&id="+id;

您還需要在鏈接上添加“ www”。

if(!strUrl.contains("https://www."))
    strUrl.replace("https://","https://www.");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM