ExtractJSONStructure(JSONValue, *Buffer, Structure)
Extract members from the given JSON value of type #PB_JSON_Object into the specified structure memory. The structure will be cleared of any previous content before extracting the JSON values.


JSONValue The JSON value. The value must be of type #PB_JSON_Object.
*Buffer The address of the structure memory to fill.
Structure The type of the structure to fill.

Return value



The extraction is performed recursively if the structure contains further structures, arrays, lists or maps. If the JSON value contains any members that do not have the proper type to match a structure member they will be ignored and the corresponding structure member is left empty.

Any '*' or '$' characters are stripped from the structure member names before comparing them to the JSON object members. So a member key must not include these characters to be properly matched to a structure member.

The comparison of member keys to structure member names is performed case sensitive. If the #JSON data was created or parsed with the #PB_JSON_NoCase flag, the comparison is performed case insensitive.


  Structure Person
    List Books.s()

  Input$ = "{" + Chr(34) + "Name" + Chr(34) + ": " + Chr(34) + "John Smith" + Chr(34) + ", " + 
                 Chr(34) + "Age" + Chr(34) + ": 42, " + 
                 Chr(34) + "Books" + Chr(34) + ": [" +
                           Chr(34) + "Investing For Dummies" + Chr(34) + ", " + 
                           Chr(34) + "A Little Bit of Everything For Dummies" + Chr(34) + "] }"
  ParseJSON(0, Input$)
  ExtractJSONStructure(JSONValue(0), @P.Person, Person)
  Debug P\Name$
  Debug P\Age
  Debug ListSize(P\Books())

See Also

ExtractJSONArray(), ExtractJSONList(), ExtractJSONMap(), InsertJSONArray(), InsertJSONList(), InsertJSONMap(), InsertJSONStructure(), SetJSONObject(), JSONType()

Supported OS


<- ExtractJSONMap() - Json Index - FreeJSON() ->