Retrieves the string 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 |
String |
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 '%JsonGetValue%'
Example XojoScript:
// Using double-quotes inside of string, to escape exception
Dim
js As String
= _
"{""subject"":""title"",""content"":""bodytext"",""recipientemail"":""support@seminar.pro""}"
// Create new JSON Object from JSON string js
Dim
handle As Integer
= JsonCreatefromString(js)
// Retrieve email address from JSON object
If
handle >= 0 Then
Dim email As String
email = JsonGetValue(handle,"recipientemail")
MsgBox("Email : " + email)
End
If