繁体   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