iOS Question Error JSON NSCocoaErrorDomain Code=3840 "Garbage at end.

MarcoRome

Expert
Licensed User
Longtime User
Hi All, i have this code

B4X:
Dim JSON As JSONParser
    Dim Map1 As Map
    JSON.Initialize(File.ReadString(File.DirAssets, "test.json"))
    Map1 = JSON.NextObject
    Log("HERE")

for both environments, B4i and B4A.
On B4A and B4J it works without any problem.
On B4i it gives the following error:

Application_Start
Error occurred on line: 36 (Main)
Error parsing string: Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end." UserInfo={NSDebugDescription=Garbage at end.}
Stack Trace: (
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 1157612
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 120016
B4i JSON -[B4IJSONParser parse] + 220
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 1175856
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 8656
B4i JSON +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
B4i JSON -[B4IShell runMethod:] + 448
B4i JSON -[B4IShell raiseEventImpl:method:args::] + 1648
B4i JSON -[B4IShellBI raiseEvent:event:params:] + 1580
B4i JSON __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
libdispatch.dylib 04B54A98-8EAD-371E-8C12-AD116CB118E2 + 393880
libdispatch.dylib 04B54A98-8EAD-371E-8C12-AD116CB118E2 + 397952
libdispatch.dylib 04B54A98-8EAD-371E-8C12-AD116CB118E2 + 65628
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 632288
CoreFoundation 6FD5304A-9759-3E22-A863-456EAB55F4CC + 608904
CoreFoundation CFRunLoopRunSpecific + 572
GraphicsServices GSEventRunModal + 160
UIKitCore 3405666F-F281-3F71-BA86-83E5A27AB5B0 + 11723736
UIKitCore UIApplicationMain + 164
B4i JSON main + 128
libdyld.dylib FC5D448B-5EE3-3786-86E7-CCE6C21A212B + 5480
)

despite being the exact same file.
Some idea ?
In attachment example... for B4i e B4A
Thank you All
 

Attachments

  • TESTJSON-B4A.zip
    31.8 KB · Views: 169
  • TESTJSON-B4i.zip
    27.4 KB · Views: 167

MarcoRome

Expert
Licensed User
Longtime User
I hadn't noticed this.
Because both in B4A, both in B4J, but also in Json Tree, everything works correctly

1612435238403.png
 
Upvote 0
Top