Jump to content
Chris Pim

JSON parsing fails on iOS but fine in Windows

Recommended Posts

I have strange problem occurring when parsing a JSON string on iOS using the System.JSON library in Berlin.

 

I call TJSONObject.ParseJSONValue() to get a value from the start of a JSON string which has worked fine if I run under Windows.

 

As soon as I run under iOS, the same JSON string causes a null pointer exception. When debugging through, the null pointer is the TJSONObject class itself which is odd as ParseJSONValue() is a class function so don’t know why that would ever happen.

 

I suspect this isn’t really the case and is just what the debugger is interpreting (the iOS debugger in Berlin isn’t great).

 

I suspect the JSON string is too large for the parser as it’s a huge string.

 

My question is whether anyone is aware of a size limit for parsing a JSON string or whether there’s a known issue in the Berlin JSON libraries which might cause this?

 

Unfortunately I can’t provide a sample JSON string as it’s a client’s backup data but hopefully someone will be able to help.

Share this post


Link to post

It looks like the issue was due to a nil character at the end of the string I was parsing, rather than a string length issue.

 

Thanks for your help Markus!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×