org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject Here is my php code: <?php $con = mysqli_connect("DBHOST", "USERNAME", "PASSWORD!", "DBNAME"); $username = $_POST["username"]; $password = $_POST["password"]; $statement = mysqli_prepare($con, "INSERT INTO user (username, password) VALUES (?, ?)"); mysqli_stmt_bind_param($statement, "ss", $username, $password); mysqli_stmt_execute($statement); $response = array(); $response["success"] = true; print_r(json_encode($response)); ?> and here is my logcat: 04-30 15:55:06.585 11289-11289/? I/art: Not late-enabling -Xcheck:jni (already on) 04-30 15:55:06.708 11289-11289/com.google.android.gms.fit.samples.basichistoryapi W/System: ClassLoader referenced unknown path: /data/app/com.google.android.gms.fit.samples.basichistoryapi-1/lib/x86 04-30 15:55:06.956 11289-11319/com.google.android.gms.fit.samples.basichistoryapi D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 04-30 15:55:07.062 11289-11319/com.google.android.gms.fit.samples.basichistoryapi I/OpenGLRenderer: Initialized EGL, version 1.4 04-30 15:55:07.094 11289-11319/com.google.android.gms.fit.samples.basichistoryapi W/EGL_emulation: eglSurfaceAttrib not implemented 04-30 15:55:07.094 11289-11319/com.google.android.gms.fit.samples.basichistoryapi W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7e0740, error=EGL_SUCCESS 04-30 15:55:19.158 11289-11289/com.google.android.gms.fit.samples.basichistoryapi W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Do you know how to solve this issue? Write a tip to help other users and build your expert profile.

Solutions on the web

via Stack Overflow by Ghazal
, 1 year ago
"] = true; print_r(json_encode($response)); ?> and here is my logcat: 04-30 15:55:06.585 11289-11289/? I/art: Not late-enabling -Xcheck:jni (already on) 04-30 15:55:06.708 11289-11289/com.google.android.gms.fit.samples.basichistoryapi W/System
via Stack Overflow by Omkar Dixit
, 7 months ago
Value <br of type java.lang.String cannot be converted to JSONObject
via Stack Overflow by Vijay
, 5 months ago
via Stack Overflow by Jonathan
, 3 months ago
Value <br of type java.lang.String cannot be converted to JSONObject
via Stack Overflow by NiamLeeson
, 8 months ago
Value true of type java.lang.Boolean cannot be converted to JSONObject
via Stack Overflow by pot34731
, 7 months ago
Value data of type java.lang.String cannot be converted to JSONObject
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject Here is my php code: <?php $con = mysqli_connect("DBHOST", "USERNAME", "PASSWORD!", "DBNAME"); $username = $_POST["username"]; $password = $_POST["password"]; $statement = mysqli_prepare($con, "INSERT INTO user (username, password) VALUES (?, ?)"); mysqli_stmt_bind_param($statement, "ss", $username, $password); mysqli_stmt_execute($statement); $response = array(); $response["success"] = true; print_r(json_encode($response)); ?> and here is my logcat: 04-30 15:55:06.585 11289-11289/? I/art: Not late-enabling -Xcheck:jni (already on) 04-30 15:55:06.708 11289-11289/com.google.android.gms.fit.samples.basichistoryapi W/System: ClassLoader referenced unknown path: /data/app/com.google.android.gms.fit.samples.basichistoryapi-1/lib/x86 04-30 15:55:06.956 11289-11319/com.google.android.gms.fit.samples.basichistoryapi D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 04-30 15:55:07.062 11289-11319/com.google.android.gms.fit.samples.basichistoryapi I/OpenGLRenderer: Initialized EGL, version 1.4 04-30 15:55:07.094 11289-11319/com.google.android.gms.fit.samples.basichistoryapi W/EGL_emulation: eglSurfaceAttrib not implemented 04-30 15:55:07.094 11289-11319/com.google.android.gms.fit.samples.basichistoryapi W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7e0740, error=EGL_SUCCESS 04-30 15:55:19.158 11289-11289/com.google.android.gms.fit.samples.basichistoryapi W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
at org.json.JSON.typeMismatch(JSON.java:111)
at org.json.JSONObject.(JSONObject.java:160)
at org.json.JSONObject.(JSONObject.java:173)
at com.google.android.gms.fit.samples.basichistoryapi.Login$2$1.onResponse(Login.java:85)
at com.google.android.gms.fit.samples.basichistoryapi.Login$2$1.onResponse(Login.java:80)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

Users with the same issue

2 times, 1 month ago
12 times, 2 months ago
22 times, 5 months ago
4 times, 1 year ago
4 times, 4 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.