简体   繁体   English

W / System.err:org.json.JSONException:值

[英]W/System.err: org.json.JSONException: Value <!— of type java.lang.String cannot be converted to JSONObject

 String url=AppConfig.URL_IP + "?register=reg&first_name="+fname+"&last_name="+lname+"&email="+email+"&address="+address+"&password="+password+"&number="+number+"&city="+city+"&category="+category;
                        Log.d("urlll",url);
                        StringRequest request=new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
                            @Override
                            public void onResponse(String response) {
                                try {
                                    JSONObject jsonObject = new JSONObject(response);
                                    boolean checkerror = jsonObject.getBoolean("error");
                                    if (checkerror) {
                                        String error_message = jsonObject.getString("error_msg");
                                        Toast.makeText(getApplicationContext(), error_message, Toast.LENGTH_SHORT).show();

                                    } else {
                                        String sucess_message = jsonObject.getString("sucess_msg");
                                        Toast.makeText(getApplicationContext(), sucess_message, Toast.LENGTH_SHORT).show();
                                    }
                                } catch (JSONException e) {
                                    e.printStackTrace();
                                }
                            }
                        }, new Response.ErrorListener() {
                            @Override
                            public void onErrorResponse(VolleyError error) {
                                Toast.makeText(getApplicationContext(),error.getMessage()+"aaaa",Toast.LENGTH_SHORT).show();
                            }
                        });
                        AppController.getInstance().addToRequestQueue(request,"registerAPI");

it is giving me this error: 它给了我这个错误:

W/System.err: org.json.JSONException: Value <!-- of type 
java.lang.String cannot be converted to JSONObject

if anyone can solve thanks in advance. 如果有人可以提前解决谢谢。

because you are trying to convert invalid JSON String to jsonObject. 因为您正在尝试将无效的JSON字符串转换为jsonObject。 check you json string in any json validator tool online. 在线检查任何json验证程序工具中的json字符串。 json validator JSON验证器

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 W / System.err:org.json.JSONException:值 - W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject W/System.err: org.json.JSONException: 类型 java.lang.String 的值数组无法转换为 JSONObject - W/System.err: org.json.JSONException: Value array of type java.lang.String cannot be converted to JSONObject W/System.err: org.json.JSONException: 类型 java.lang.String 的值数据库无法转换为 JSONObject - W/System.err: org.json.JSONException: Value Database of type java.lang.String cannot be converted to JSONObject Volley库W / System.err:org.json.JSONException:类型为java.lang.String的Value Connected无法转换为JSONObject - Volley library W/System.err: org.json.JSONException: Value Connected of type java.lang.String cannot be converted to JSONObject W/System.err: org.json.JSONException: Value [] at 0 of type org.json.JSONArray 无法转换为 JSONObject - W/System.err: org.json.JSONException: Value [] at 0 of type org.json.JSONArray cannot be converted to JSONObject 解析数据org.json.JSONException时出错:值 - Error parsing data org.json.JSONException: Value <!— of type java.lang.String cannot be converted to JSONObject 错误。 org.json.JSONException:值 - error. org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject org.json.JSONException:值<HTML><HEAD> - org.json.JSONException: Value <HTML><HEAD><STYLE of type java.lang.String cannot be converted to JSONObject android错误org.json.JSONException:值 - android error org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject org.json.JSONException:类型为java.lang.String的值test(无法转换为JSONObject - org.json.JSONException: Value test( of type java.lang.String cannot be converted to JSONObject
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM