Adds a JSON child element of type Boolean to an existing JSON object.
JSON is a lightweight data exchange format. It is described
at http://json.org. It is based on the Javascript
language.
The JSON Objects used in Seminar Pro contain a collection of
key-value pairs.
(The internal JSON
object is of Xojo type JSONItem [classic
Xojo framework])
Parameters:
Name |
Type |
Description |
jsnHandle |
Integer |
A
pointer to the created JSON object, of type Integer Is 0
or higher, if JSON object exists |
key |
String |
The exact
name of the key for which its value will be set. |
value |
Boolean |
The boolean
value to be attributed to the key. The
value is either true or false |
Available in:
WindowMain |
WindowLink |
YES |
YES |
Hint: You can
find references to XojoScripts which make use of this function by sending the
following SQL statement to the database:
Select id,GUID, ScriptName,ScriptCode from
im_scripts where ScriptCode Like '%JsonSetValueBoolean%'
Example XojoScript:
// Create a new JSON object
Dim
handle As Integer
= JsonCreate
If
handle >= 0 Then
// Add key-value pairs to
the JSON object
JsonSetValue(handle,"subject","title")
JsonSetValueBoolean(handle,"member",True)
JsonSetValue(handle,"email","support@seminar.pro")
// Convert JSON object to
a string
Dim js As String = JsonToString(handle)
// Show JSON string to
user. It should look like this:
//
{"subject":"title","member":true,"email":"support@seminar.pro"}
MsgBox(js)
// Now we create a new
JSON object from this string
handle = JsoncreateFromString(js)
// Retrieve Boolean value
from new JSON object
// If member=true then we
display YES
Dim msg As String = "Is member : " + If(JsonGetValueBoolean(handle,"member"),"YES","NO")
// Show message with
boolean value to user
MsgBox(msg)
End
If