It appears as though I am struggling today with JSON...
I have created a test class, with the following class globals:
I then create a couple of test instances of my class, and add them to a list:
What I get in the resulting JSONis a mish-mash of the class variables, but also mention of other classes in my b4a project, which I have no idea why they are there( why for example is dateutils serialized?):
["[createddate=, crypt=null, dateutils=null\n, errmsg=, fromuserguid=, guid=1\n, httputils=null, httputils2service=null, httputilsservice=null\n, listname=, main=null, mainitemtype=\n, manageexercisesactivity=null, manageroutinesactivity=null, notes=\n, ownerguid=, profiledetailsactivity=null, profilehomeactivity=null\n, registeractivity=null, starter=null, statemanager=null\n, success=false, summary=, transactiondate=\n, transactionguid=, transactiontype=]","[createddate=, crypt=null, [B]dateutils[/B]=null\n, errmsg=, fromuserguid=, guid=2\n, httputils=null, httputils2service=null, httputilsservice=null\n, listname=, main=null, mainitemtype=\n, manageexercisesactivity=null, manageroutinesactivity......
3 questions:
Why are the non class variables serialized in the JSON?
Can I set a marker against each class variable that i want to be serialized?
Why does the debugger chop off the end of the variable data I am watching and put ..... at the end? - it makes it difficult to extract large text chunks from variables to see what is going on!
I have created a test class, with the following class globals:
B4X:
Sub Class_Globals
Dim GUID As String
Dim listName As String
Dim mainItemType As String
Dim createdDate As String
Dim ownerGUID As String
Dim transactionGUID As String
Dim transactionType As String
Dim fromUserGUID As String
Dim transactionDate As String
Dim notes As String
Dim summary As String
Dim success As Boolean
Dim errMsg As String
End Sub
I then create a couple of test instances of my class, and add them to a list:
B4X:
Dim list As List
list.Initialize
Dim x As TestClass
x.Initialize
x.GUID = "1"
list.Add( x )
Dim xx As TestClass
xx.Initialize
xx.GUID = "2"
list.Add( xx )
Dim jg As JSONGenerator
jg.Initialize2( list )
json = jg.ToString
What I get in the resulting JSONis a mish-mash of the class variables, but also mention of other classes in my b4a project, which I have no idea why they are there( why for example is dateutils serialized?):
["[createddate=, crypt=null, dateutils=null\n, errmsg=, fromuserguid=, guid=1\n, httputils=null, httputils2service=null, httputilsservice=null\n, listname=, main=null, mainitemtype=\n, manageexercisesactivity=null, manageroutinesactivity=null, notes=\n, ownerguid=, profiledetailsactivity=null, profilehomeactivity=null\n, registeractivity=null, starter=null, statemanager=null\n, success=false, summary=, transactiondate=\n, transactionguid=, transactiontype=]","[createddate=, crypt=null, [B]dateutils[/B]=null\n, errmsg=, fromuserguid=, guid=2\n, httputils=null, httputils2service=null, httputilsservice=null\n, listname=, main=null, mainitemtype=\n, manageexercisesactivity=null, manageroutinesactivity......
3 questions:
Why are the non class variables serialized in the JSON?
Can I set a marker against each class variable that i want to be serialized?
Why does the debugger chop off the end of the variable data I am watching and put ..... at the end? - it makes it difficult to extract large text chunks from variables to see what is going on!