ExtractJSONList()
Syntax
ExtractJSONList(JSONValue, List())Description
Extract elements from the given JSON value of type #PB_JSON_Array into the specified List(). The list will be resized to the number of elements contained in the JSON value.
Parameters
JSONValue The JSON value. The value must be of type #PB_JSON_Array. List() The list to fill with the JSON elements. The list will be resized to have the same size as the JSON value. Any previous content of the list will be lost.
Return value
None.
Remarks
The extraction is performed recursively if the list has a structure type. If the JSON value contains any elements that do not have the proper type to match the List(), they will be ignored and the corresponsing list element will be left empty.
Example
Input$ = "[ {" + Chr(34) + "x" + Chr(34) + ": 10, " + Chr(34) + "y" + Chr(34) + ": 20}, " + "{" + Chr(34) + "x" + Chr(34) + ": 30, " + Chr(34) + "y" + Chr(34) + ": 50}, " + "{" + Chr(34) + "x" + Chr(34) + ": -5, " + Chr(34) + "y" + Chr(34) + ": 100} ]" Structure Location x.l y.l EndStructure NewList Locations.Location() ParseJSON(0, Input$) ExtractJSONList(JSONValue(0), Locations()) ForEach Locations() Debug Str(Locations()\x) + ", " + Str(Locations()\y) Next
See Also
ExtractJSONArray(), ExtractJSONMap(), ExtractJSONStructure(), InsertJSONArray(), InsertJSONList(), InsertJSONMap(), InsertJSONStructure(), SetJSONArray(), JSONType()
Supported OS
All