AddItemBoolean

Description

Adds a child item of JsonBooleanItem type in the JSON generator object.

Applies to

JSONGenerator objects

Syntax

objectname.AddItemBoolean ( ParentItemHandle, Value )
objectname.AddItemBoolean ( ParentItemHandle, Key, Value )
objectname.AddItemBoolean ( ParentItemPath, Value )
objectname.AddItemBoolean ( ParentItemPath, Key, Value )

Argument

Description

objectname

The name of the JSONGenerator object in which you want to add an item

ParentItemHandle

A long whose value is the handle of the parent item of JsonArrayItem or JsonObjectItem type

ParentItemPath

A string whose value is the path of the parent item of JsonArrayItem or JsonObjectItem type

Key

A string whose value is the key of the child item

Value

A boolean whose value is the value of the child item


Return value

Long.

Returns the handle of the new child item if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.

Example 1

This example creates an array root item and adds a boolean child item.

JsonGenerator lnv_JsonGenerator 
Long ll_RootArray
lnv_JsonGenerator = Create JsonGenerator

// Creates an array root item
ll_RootArray = lnv_JsonGenerator.CreateJsonArray()

// Adds a boolean child item
lnv_JsonGenerator.AddItemBoolean(ll_RootArray, true)

Example 2

This example creates an object root item and adds a boolean child item.

JsonGenerator lnv_JsonGenerator
Long ll_RootObject
lnv_JsonGenerator = Create JsonGenerator

// Creates an object root item
ll_RootObject = lnv_JsonGenerator.CreateJsonObject ()

// Adds a boolean child item
lnv_JsonGenerator.AddItemBoolean(ll_RootObject, "boolean", true)

Example 3

This example creates an array root item and adds a boolean child item.

JsonGenerator lnv_JsonGenerator 
String ls_Path
lnv_JsonGenerator = Create JsonGenerator

// Creates an array root item
lnv_JsonGenerator.CreateJsonArray()
ls_Path = "/"

// Adds a boolean child item
lnv_JsonGenerator.AddItemBoolean(ls_Path, true)

Example 4

This example creates an object root item and adds a boolean child item.

JsonGenerator lnv_JsonGenerator
String ls_Path
lnv_JsonGenerator = Create JsonGenerator

// Creates an object root item
lnv_JsonGenerator.CreateJsonObject ()
ls_Path = "/"

// Adds a boolean child item
lnv_JsonGenerator.AddItemBoolean(ls_Path, "boolean", true)

See also

AddItemArray

AddItemBlob

AddItemDate

AddItemDateTime

AddItemNull

AddItemNumber

AddItemObject

AddItemString

AddItemTime