iOS Question jsonParser , how to allow fragments?

omarruben

Active Member
Licensed User
Longtime User
I have this error :

Error parsing string: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

how to allow fragments?


B4X:
Dim parser As JSONParser
jsonstring = "{"message":"ok","error":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTM3NzkyMDB9.irt65S41YrqnozMrDJXxHddk1JcTFiLxGcfcLXbf2jE","userid":"10"}} "
    parser.Initialize(jsonstring)
      
    Dim messagex As Map
    messagex = parser.NextObject
 
Last edited:

hatzisn

Well-Known Member
Licensed User
Longtime User
Could the space characters in the biggining and at the end be the problem? Have you tried trimming the string?
 
Upvote 0
Top