Hi there
Am a little confused as to how to get JSONGenerator.ToString to work.
I understand going from JSON maps and so on into a List and how to parse that, but I am confused about going the other way, for example from a SQL SELECT request into JSON strings.
I’ve created my own data type, BASE, and I use the following code to put BASE objects into a List which I return back to do with whatever I want. This code works fine, but I’d like to understand the JSON stuff a bit more.
How would I change this code to create JSON strings that I could return for use by a JSON parser? I have tried everything I can think of and am now stumped.
It’s fairly self-explanatory but the fields are ID, NAME_BASE, INFO, CITY in the example below.
Sub ReadBaseDataFromDB(SQL1 As SQL) As List
Cursor1.Close
Return BaseListEnd Sub
Am a little confused as to how to get JSONGenerator.ToString to work.
I understand going from JSON maps and so on into a List and how to parse that, but I am confused about going the other way, for example from a SQL SELECT request into JSON strings.
I’ve created my own data type, BASE, and I use the following code to put BASE objects into a List which I return back to do with whatever I want. This code works fine, but I’d like to understand the JSON stuff a bit more.
How would I change this code to create JSON strings that I could return for use by a JSON parser? I have tried everything I can think of and am now stumped.
It’s fairly self-explanatory but the fields are ID, NAME_BASE, INFO, CITY in the example below.
Sub ReadBaseDataFromDB(SQL1 As SQL) As List
Dim BaseList As List
BaseList.Initialize
Dim Cursor1 As Cursor
Cursor1 = SQL1.ExecQuery("SELECT * FROM BASES")
For i = 0 To Cursor1.RowCount - 1
BaseList.Initialize
Dim Cursor1 As Cursor
Cursor1 = SQL1.ExecQuery("SELECT * FROM BASES")
For i = 0 To Cursor1.RowCount - 1
Dim NewBase As BASE
NewBase.Initialize
Cursor1.Position = i
NewBase.ID=Cursor1.GetInt("ID")
NewBase.NAME_BASE=Cursor1.GetString("NAME_BASE")
NewBase.INFO=Cursor1.GetString("INFO")
NewBase.CITY=Cursor1.GetString("CITY")
BaseList.Add(NewBase)
NextNewBase.Initialize
Cursor1.Position = i
NewBase.ID=Cursor1.GetInt("ID")
NewBase.NAME_BASE=Cursor1.GetString("NAME_BASE")
NewBase.INFO=Cursor1.GetString("INFO")
NewBase.CITY=Cursor1.GetString("CITY")
BaseList.Add(NewBase)
Cursor1.Close
Return BaseList