Description
Adds a child item of JsonNullItem type in the JSON generator object.
Applies to
Syntax
objectname.AddItemNull ( ParentItemHandle )
objectname.AddItemNull ( ParentItemHandle, Key )
objectname.AddItemNull ( ParentItemPath )
objectname.AddItemNull ( ParentItemPath, Key )
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 |
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 null child item. The result is [null].
Long ll_RootArray JsonGenerator lnv_JsonGenerator lnv_JsonGenerator = Create JsonGenerator // Creates an array root item ll_RootArray = lnv_JsonGenerator.CreateJsonArray() // Adds a null child item lnv_JsonGenerator.AddItemNull(ll_RootArray)
Example 2
This example creates an object root item and adds a null child item. The result is {"null":null}.
Long ll_RootObject JsonGenerator lnv_JsonGenerator lnv_JsonGenerator = Create JsonGenerator // Creates an object root item ll_RootObject = lnv_JsonGenerator.CreateJsonObject () // Adds a null child item lnv_JsonGenerator.AddItemNull(ll_RootObject, "null")
Example 3
This example creates an array root item and adds a null child item.
String ls_Path JsonGenerator lnv_JsonGenerator lnv_JsonGenerator = Create JsonGenerator // Creates an array root item lnv_JsonGenerator.CreateJsonArray() ls_Path = "/" // Adds a null child item lnv_JsonGenerator.AddItemNull(ls_Path)
Example 4
This example creates an object root item and adds a null child item.
String ls_Path JsonGenerator lnv_JsonGenerator lnv_JsonGenerator = Create JsonGenerator // Creates an object root item lnv_JsonGenerator.CreateJsonObject() ls_Path = "/" // Adds a null child item lnv_JsonGenerator.AddItemNull(ls_Path, "null")
See also