Android Question HTTPJob.GetString is truncating JSON

Homerclese

Member
Licensed User
Longtime User
My web services return utf-8 formatted text data (the response header contains Content-Type: application/json; charset=utf-8) and I have an iOS app that successfully consumes these web services.

However using HTTPJob.GetString on the same web services results in a string that gets truncated at the same point every time and I'm wondering if there might be a character causing an issue.

I've searched this forum and it seems I'm not the only one to experience this problem but it's not clear to me what the solution is when the character set is already utf-8.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
HttpJob.GetString doesn't truncate the text.

I've searched this forum and it seems I'm not the only one to experience this problem
All of the issues you saw are related to the Log keyword which truncates the log message after 4000 characters (and prints a message that the string was truncated).

You can check the length with:
B4X:
Dim s As String = HttpJob.GetString
Log(s.Length)
 
Upvote 0

Homerclese

Member
Licensed User
Longtime User
I didn't see any related to Log. The length being returned is under 800 characters so it's not that.
 
Upvote 0

Homerclese

Member
Licensed User
Longtime User
Ahh, OK. It does report that the message is longer than the Log limit. Which would be right because it is an array of records. I wasn't looking at it this way before. I was using a break point and copying it out of the debugger and it was being truncated to less than 800 characters so I assumed that this was the reason why JSONParser.Initialize couldn't handle it.
 
Upvote 0

Homerclese

Member
Licensed User
Longtime User
It was just my lack of understanding how the JSON serializer works in B4A. Sorry for the time wasting Erel...I wish I could delete this whole thread.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…