Adds a JSON child element of type Double 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 |
Double |
The double
value to be attributed to the key. This is
a floating point numeric value, like 20.55 |
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 '%JsonSetValueDouble%'
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")
JsonSetValueDouble(handle,"fee",20.55)
// Convert JSON object to
a string
Dim js As String = JsonToString(handle)
// Show JSON string to
user. It should look like this:
//
{"subject":"title","fee":20.550000000000001}
MsgBox(js)
// Now we create a new
JSON object from this string
handle = JsonCreateFromString(js)
// Retrieve Double value
from new JSON object
Dim msg As String = "Fee : " + Str(JsonGetValueDouble(handle,"fee"))
// Show message with double
value to user
MsgBox(msg)
End
If