JsonSetValueInteger(jsnHandle As Integer, key As String, value As Integer)

 

Adds a JSON child element of type Integer 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

Integer

The integer value to be attributed to the key.

This is a numeric value, like 15

An Integer is a number that can be written without a fractional component.

 

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 '%JsonSetValueInteger%'

 

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")

JsonSetValueInteger(handle,"counter",15)

 

// Convert JSON object to a string

Dim js As String = JsonToString(handle)

 

// Show JSON string to user. It should look like this:

// {"subject":"title","counter":15}

MsgBox(js)

 

// Now we create a new JSON object from this string

handle = JsoncreateFromString(js)

 

// Retrieve Integer value from new JSON object

Dim msg As String = "Counter : " + Str(JsonGetValueInteger(handle,"counter"))

 

// Show message with integer value to user

MsgBox(msg)

 

End If