0
 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.

0

1 Answer 1

0

because you are trying to convert invalid JSON String to jsonObject. check you json string in any json validator tool online. json validator

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.