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

Stack Overflow | Ghazal | 12 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    android php org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject

    Stack Overflow | 12 months ago | Ghazal
    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
  2. 0

    获取用户信息报错

    GitHub | 2 years ago | ljsalm089
    org.json.JSONException: Value javax.net.ssl.SSLPeerUnverifiedException of type java.lang.String cannot be converted to JSONObject
  3. 0

    Error Report: Value <!doctype of type java.lang.String cannot be converted to JSONObject

    GitHub | 2 years ago | rastating
    org.json.JSONException: Value <!doctype of type java.lang.String cannot be converted to JSONObject
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error Report: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

    GitHub | 2 years ago | rastating
    org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
  6. 0

    Error Report: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

    GitHub | 2 years ago | rastating
    org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Android Platform
    JSONObject.<init>
    1. org.json.JSON.typeMismatch(JSON.java:111)
    2. org.json.JSONObject.<init>(JSONObject.java:160)
    3. org.json.JSONObject.<init>(JSONObject.java:173)
    3 frames
  3. com.google.android
    Login$2$1.onResponse
    1. com.google.android.gms.fit.samples.basichistoryapi.Login$2$1.onResponse(Login.java:85)
    2. com.google.android.gms.fit.samples.basichistoryapi.Login$2$1.onResponse(Login.java:80)
    2 frames
  4. Android-Volley Library
    ExecutorDelivery$ResponseDeliveryRunnable.run
    1. com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60)
    2. com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
    3. com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
    3 frames
  5. Android Platform
    ActivityThread.main
    1. android.os.Handler.handleCallback(Handler.java:739)
    2. android.os.Handler.dispatchMessage(Handler.java:95)
    3. android.os.Looper.loop(Looper.java:148)
    4. android.app.ActivityThread.main(ActivityThread.java:5417)
    4 frames
  6. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  7. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    2 frames