Hi.
I'm working with JSON strings that a webservice sends to my app, but it crashes with a strange behaviour.
If I do this:
On the log it puts this:
It means that the list returned by NextArray has 2 elements, but it crashes when I try to assign to a list to handle it.
I've tried the online tool to check the string is right and it seems yes...
Can someone bring some light on this?
Thank you in advance.
I'm working with JSON strings that a webservice sends to my app, but it crashes with a strange behaviour.
If I do this:
B4X:
Log(JSONParser.NextArray.Size)
Dim l As List
l=JSONParser.NextArray
2
Error occurred on line: 156 (Main)
org.json.JSONException: End of input at character 453 of [{"j1":"976","n1":"10","j2":"974","n2":"4","j3":"971","n3":"7","j4":"973","n4":"9","j5":"978","n5":"28","j6":"972","n6":"44","j7":"975","n7":"55","j8":"980","n8":"57","j9":"979","n9":"74","j10":"977","n10":"31","equipo":"17"},{"j1":"1000","n1":"1","j2":"998","n2":"4","j3":"996","n3":"5","j4":"997","n4":"9","j5":"993","n5":"15","j6":"995","n6":"57","j7":"999","n7":"77","j8":"994","n8":"78","j9":"1001","n9":"88","j10":"992","n10":"10","equipo":"20"}]
at org.json.JSONTokener.syntaxError(JSONTokener.java:449)
at org.json.JSONTokener.nextValue(JSONTokener.java:97)
at anywheresoftware.b4a.objects.collections.JSONParser.NextArray(JSONParser.java:60)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:338)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5665)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
Error occurred on line: 156 (Main)
org.json.JSONException: End of input at character 453 of [{"j1":"976","n1":"10","j2":"974","n2":"4","j3":"971","n3":"7","j4":"973","n4":"9","j5":"978","n5":"28","j6":"972","n6":"44","j7":"975","n7":"55","j8":"980","n8":"57","j9":"979","n9":"74","j10":"977","n10":"31","equipo":"17"},{"j1":"1000","n1":"1","j2":"998","n2":"4","j3":"996","n3":"5","j4":"997","n4":"9","j5":"993","n5":"15","j6":"995","n6":"57","j7":"999","n7":"77","j8":"994","n8":"78","j9":"1001","n9":"88","j10":"992","n10":"10","equipo":"20"}]
at org.json.JSONTokener.syntaxError(JSONTokener.java:449)
at org.json.JSONTokener.nextValue(JSONTokener.java:97)
at anywheresoftware.b4a.objects.collections.JSONParser.NextArray(JSONParser.java:60)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:338)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5665)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
I've tried the online tool to check the string is right and it seems yes...
Can someone bring some light on this?
Thank you in advance.