Android Question [Resolved]java.lang.RuntimeException: JSON Object expected.

Douglas Farias

Expert
Licensed User
Longtime User
{"Exists":true,"Blocked":false,"User":{"UserID":"13","NickName":"doidloko","ProfilePictureUrl":"asdaswdw","Status":"1"}}


B4X:
    Case "jobverificausuario"
    Log(respostadoservidor)
    Dim parser As JSONParser
    parser.Initialize(respostadoservidor)
    Dim root As Map = parser.NextObject
    Dim Exists As String = root.Get("Exists")
    Dim Blocked As String = root.Get("Blocked")

why i have error on the
Dim root As Map = parser.NextObject
this is a valid json o_O

LogCat connected to: B4A-Bridge: motorola XT1033-359321054369100
--------- beginning of /dev/log/main
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:click.fight.google
Installing file.
Installing file.
Installing file.
PackageAdded: package:click.fight.google
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (redessociais) Create, isFirst = true **
** Activity (redessociais) Resume **
Confere Usuário Facebook!
ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{42c52498: android.os.BinderProxy@427604b8}}
<br />
<b>Notice</b>: Undefined property: Controller\UserModel::$Strikes in <b>C:\xampp\htdocs\clickfight\derp\Controller\User.php</b> on line <b>75</b><br />
{"Exists":true,"Blocked":false,"User":{"UserID":"13","NickName":"doidloko","ProfilePictureUrl":"asdaswdw","Status":"1"}}
java.lang.RuntimeException: JSON Object expected.
at anywheresoftware.b4a.objects.collections.JSONParser.NextObject(JSONParser.java:50)
at click.fight.google.redessociais._jobdone(redessociais.java:703)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:952)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:click.fight.google
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (redessociais) Create, isFirst = true **
** Activity (redessociais) Resume **
Confere Usuário Facebook!
ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41f6edb8: android.os.BinderProxy@41f95f20}}
<br />
<b>Notice</b>: Undefined property: Controller\UserModel::$Strikes in <b>C:\xampp\htdocs\clickfight\derp\Controller\User.php</b> on line <b>75</b><br />
{"Exists":true,"Blocked":false,"User":{"UserID":"13","NickName":"doidloko","ProfilePictureUrl":"asdaswdw","Status":"1"}}
java.lang.RuntimeException: JSON Object expected.
at anywheresoftware.b4a.objects.collections.JSONParser.NextObject(JSONParser.java:50)
at click.fight.google.redessociais._jobdone(redessociais.java:700)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:952)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
 

Douglas Farias

Expert
Licensed User
Longtime User
¬¬ i found
result is not only the json
<br />
<b>Notice</b>: Undefined property: Controller\UserModel::$Strikes in <b>C:\xampp\htdocs\clickfight\derp\Controller\User.php</b> on line <b>75</b><br />
{"Exists":true,"Blocked":false,"User":{"UserID":"13","NickName":"doidloko","ProfilePictureUrl":"asdaswdw","Status":"1"}}
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
¬¬ i found
result is not only the json

So the problem is your php-script. Normally it should not produce any warnings and notices. If this happen you made something wrong and you need to change your "wrong" php-code.
 
Upvote 0
Top