AddItemString

Description

Adds the child item of JsonStringItem type.

Applies to

JSONGenerator objects

Syntax

objectname.AddItemString ( ParentItemHandle, Value )
objectname.AddItemString ( ParentItemHandle, 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

Key

A string whose value is the key of the child item

Value

A string 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 item and then adds a string child item:

JsonGenerator lnv_JsonGenerator
Long ll_RootArray
lnv_JsonGenerator = Create JsonGenerator

ll_RootArray = lnv_JsonGenerator.CreateJsonArray()
lnv_JsonGenerator.AddItemString(ll_RootArray, "string")

Example 2

This example creates an object item and then adds a string child item:

JsonGenerator lnv_JsonGenerator 
Long ll_RootObject
lnv_JsonGenerator = Create JsonGenerator

ll_RootObject = lnv_JsonGenerator.CreateJsonObject ()
lnv_JsonGenerator.AddItemString(ll_RootObject, "string", "value")

See also

AddItemArray

AddItemBlob

AddItemBoolean

AddItemDate

AddItemDateTime

AddItemNull

AddItemNumber

AddItemObject

AddItemTime