Retrieves the boolean value of a JSON child element.
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 successfully has been created If
jsnHandle is -1, then the creation failed If
jsnHandle is -2, then a runtime exception occurred |
key |
String |
The exact
name of the key for which its value will be returned. The
string "key not found" is returned,
if a wrong key is used. |
Returns:
Type |
Value |
Description |
Boolean |
value
of JSON child element |
The JSON Objects used in Seminar Pro contain
a collection of name-value pairs. You pass in the the key and the corresponding value is returned. |
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 '%JsonGetValueBoolean%'
Example XojoScript:
// Using double-quotes inside of string, to escape exception
// For Booleans, use 0 or 1, false or true
Dim
js As String
= "{""member"":true,""email"":""support@seminar.pro""}"
// Create new JSON Object from JSON string js
Dim
handle As Integer
= JsonCreatefromString(js)
// Retrieve member status from JSON object
If
handle >= 0 Then
Dim isMember As Boolean
isMember = JsonGetValueBoolean(handle,"member")
MsgBox("Is member : " + If(isMember,"YES","NO"))
End
If