Doing something fairly simple with the JSON Parser within Lotusscript. Call a Domino Web Agent with a GET, and passing as the body:
{"name":"John", "age":30, "car":null}
The Strange thing is, if I used preferUTF8 parameter the string is coming across with a type of 6, which is not documented. If I don't use preferUTF8 then the string comes across with a type of 3.
Does anyone know why the difference?
Here is a snippet of the Lotusscript Code
Dim incomingJSONNav As NotesJSONNavigator
Dim incomingJSONElement As NotesJSONElement
Set incomingJSONNav = Session.CreateJSONNavigator(session.DocumentContext.Request_Content(0))
incomingJSONNav.Preferutf8 = True
Print IncomingJSONNav.Getelementbyname("name").type
Print IncomingJSONNav.Getelementbyname("age").type
Print IncomingJSONNav.Getelementbyname("car").type
If you use PreferUTF8= true this returns 6, 4, 64
if you used PreferUTF=false this returns 3, 4, 64
The documentation is pretty poor for the JSON classes, and it shows the return types as:
Jsonelem_type_array
Jsonelem_type_boolean
Jsonelem_type_empty
Jsonelem_type_number
Jsonelem_type_object
Jsonelem_type_string
but doesn't actually say what integer each is, so if anyone else ever needs this they are:
Jsonelem_type_object 1
Jsonelem_type_array 2
Jsonelem_type_string 3
Jsonelem_type_number 4
Jsonelem_type_boolean 5
Jsonelem_type_empty 64