Description
Gets the handle value of the child item whose type is object.
Applies to
JSONParser objects
Syntax
objectname.GetItemObject ( ParentItemHandle, Key )
Argument |
Description |
---|---|
objectname |
The name of the JSONParser object whose child object 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 JsonObjectItem type. |
Return value
Long.
Returns the handle value of the child item if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Usage
If the item value is null, this function will throw an error, therefore, it is recommended that before executing this function, call GetItemType to check if the item value is null. See example 2 in GetItemArray.
Examples
This example gets the value of the "date_object" item:
JsonParser lnv_JsonParser String ls_Json DateTime ldt_datetime Date ldate_date Time lt_time Long ll_RootObject, ll_date_object lnv_JsonParser = Create JsonParser ls_Json = '{"id":1001, "name":"evan", "date_object":{"datetime":7234930293, “date”: "2017-09-21", "time": "12:00:00"}}' lnv_JsonParser.LoadString(ls_Json) ll_RootObject = lnv_JsonParser.GetRootItem() ll_date_object = lnv_JsonParser.GetItemObject(ll_RootObject, "date_object") ldt_datetime = lnv_JsonParser.GetItemDateTime(ll_date_object , "datetime") ldate_date = lnv_JsonParser.GetItemDate(ll_date_object , "date") lt_time = lnv_JsonParser.GetItemTime(ll_date_object , "time")
See also