Description
Gets the value of the item whose type is array.
Applies to
JSONParser objects
Syntax
objectname.GetItemArray ( ParentItemHandle, Key )
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONParser object whose array item you want to obtain. |
|
ParentItemHandle |
A long whose value is the handle of the parent item of JsonObjectItem type. |
|
Key |
A string whose value is the key of the child item of JsonArrayItem type. |
Return value
Long.
Returns the value of the child item of an array if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Example 1
JsonParser lnv_JsonParser
Long ll_RootObject, ll_department_array
lnv_JsonParser = Create JsonParser
ls_Json = '{"id":1001, "name":"evan", "department_array":[999999, {"name":"Website"}, {"name":"PowerBuilder"}, {"name":"IT"}] }'
lnv_JsonParser.LoadString(ls_Json)
ll_RootObject = lnv_JsonParser.GetRootItem()
ll_department_array = lnv_JsonParser.GetItemArray(ll_RootObject, "department_array")
ll_number_item = lnv_JsonParser.GetChildItem(ll_department_array, 1)
ll_number = lnv_JsonParser.GetItemNumber(ll_number_item)
ll_object_item = lnv_JsonParser.GetChildItem(ll_department_array, 2)
ls_name = lnv_JsonParser.GetItemString(ll_object_item, "name")
See also


