If you are already using the NotesHTTPRequest and / or NotesJSONNavigator classes in your code and you are experiencing one of the following issues, here is an important technote for you.
- SPR# DCONB8VMAV – NotesJSONNavigator is unable to parse JSON content > 64k
- SPR# ASHEB95LFR – Unable to parse JSON string: Missing a name for object member, offset 1
- SPR# DCONB8F6JV – bad character conversion happening in NotesHTTPRequest response
- SPR# ASHEB95LFR – NotesJSONNavigator unable to navigate a string which contains new lines and carriage returns
- SPR# DCONBB2KNR – NotesJSONNavigator experiencing severe issues when parsing packages with empty string values
- SPR# JCORBB2KWU – Unable to Post > 64K String in NotesHTTPRequest
- SPR# DCONBB44T4 – Creating a NotesJSONNavigator from nulled response causes crash
Hi Ulrich,
Great news that HCL are fixing bugs like this so quickly.
It seems that, sadly, there’s still a bug in the NotesJSONNavigator class – specifically with NotesJSONElement.
I’ve updated my client to 10.0.1 FP2, and if I parse a >64kB JSON string, I am successful, however if any of the elements parsed are >64kB, then NotesJSONElement displays strange results.
My test code is as follows:
Sub Initialize
Dim sess As New NotesSession
Dim stream As NotesStream
Dim nav As NotesJSONNavigator
Dim el As NotesJSONElement
Dim i%
Set stream = sess.CreateStream
Call stream.WriteText(|{“json_text”:”|)
For i = 1 To 6553 ‘ 6553 x 10 bytes = 65530 bytes
Call stream.WriteText(Format$(i, “000000000”) & ” “, EOL_NONE) ‘ 10 bytes per iteration
Next
Call stream.WriteText(|”}|)
stream.Position = 0
Set nav = sess.CreateJSONNavigator(stream.ReadText)
Set el = nav.GetElementByName(“json_text”)
MsgBox el.Name
MsgBox Len(el.Value)
End Sub
With the code above, I receive the results from MsgBox: “json_text” and 65530, which is correct.
However, if I increase the iterator “i” from 6553 to 6554, I would expect to see “json_text” and 65540, but instead I see the number 4. Changing the iterator from 6554 to 6555, I should see 65550, but instead I get 14.
Looking in more detail, it appears that NotesJSONElement always returns the left side of the json_text, but the number of characters I receive is effectively ([Length of JSON string] modulo 65536). So there is no way to access strings >64kB.
I’ve tried wrapping ‘el.Value’ with a ForAll, but it seems the Variant returned is not an array that can be traversed.
Any ideas?