Android Question JSON Parser

Discussion in 'Android Questions' started by BarryW, Jun 28, 2015.

  1. BarryW

    BarryW Active Member Licensed User

    Hi masters. I get an output from httpjob

    [{"id_":"12","last_name":"x","middle_name_":"x","first_name_":"x","gender_":"Male","email_":"x","secret_question_":"Secret 1","secret_answer_":"x","password_":"x","student_no_":"x","program_":"x"}]

    why does JSON Parser Error on this

    Error Message:

    org.json.JSONException: End of input at character 197 of [{"id_":"12","last_name":"x","middle_name_":"x","first_name_":"x","gender_":"Male","email_":"x","secret_question_":"Secret 1","secret_answer_":"x","password_":"x","student_no_":"x","program_":"x"}]
    at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
    at org.json.JSONTokener.nextValue(JSONTokener.java:97)
    at anywheresoftware.b4a.objects.collections.JSONParser.NextObject(JSONParser.java:48)
    at escalera.instafolio.proj.main._jobdone(main.java:1442)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:962)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5257)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
    at dalvik.system.NativeStart.main(Native Method)
     
  2. Ohanian

    Ohanian Active Member Licensed User

    Hi,

    Your json seems ok, checked with this:

    Code:
    http://www.basic4ppc.com:51042/json/index.html
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should call NextArray instead of NextObject.
     
Loading...