JsonCreate

 

Creates a new JSON object and returns a pointer to it.

 

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

 

Once a JSON object exists, one can add child values to it by using the script command JsonSetValue.

Once all child values have been added, one can generate a JSON String with JsonToString.

 

Example JSON String: {"subject":"title","content":"bodytext","recipientemail":"support@seminar.pro"}

 

A JSON String can be stored in a database or be sent over internet or used with the EmailOpen function.

 

From a JSON String, a new JSON object can again be created with JsonCreateFromString.

 

 

Returns:

 

Type

Value

Description

Integer

Handle to JSON object

Returns a pointer to the created JSON object, of type Integer

Returns 0 or higher, if JSON object successfully has been created

 

If -1 is returned, then the creation failed

If -2 is returned, then a runtime exception occured

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Send Seminar Invoice by Email

024F872B-9E87-499F-9D2D-208C4C32E4CF

 

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

 

Example XojoScript:

 

Dim handle As Integer = JsonCreate

If handle >= 0 Then

 

JsonSetValue(handle,"subject","title")

JsonSetValue(handle,"content","bodytext")

JsonSetValue(handle,"recipientemail","support@seminar.pro")

 

Dim js As String = JsonToString(handle)

 

 

// {"subject":"title","content":"bodytext","recipientemail":"support@seminar.pro"}

MsgBox(js)

 

End If