XPRIM_JsonObject and XPRIM_JsonArray is an in-memory representation of JSON objects and JSON arrays. They store their child elements in a tree-like structure in memory, to support random access of elements by member name and array index. XPRIM_JsonObject and XPRIM_JsonArray have a common superclass, XPRIM_JsonElement.
As XPRIM_JsonObject/XPRIM_JsonArray are both readable and modifiable (with random access support), they are useful when you need to create an abstract, in-memory, representation of your JSON data, that you need to pass around, to another routine or any third-party library routines.
Note however that if you just need to construct a JSON string (that is, a string representation of a JSON data), you should use XPRIM_JsonWriter instead as XPRIM_JsonWriter is specifically designed to construct a JSON string, so it does that very efficiently, with a minimum memory footprint. Similarly, if you just need to parse a JSON string and read its values, you'd be better off using XPRIM_RandomAccessJsonReader or XPRIM_JsonReader. XPRIM_JsonWriter and XPRIM_JsonReader will be discussed in the next section.
Here is how you create an XPRIM_JsonObject and an XPRIM_JsonArray:
Define_Com Class(#XPRIM_JsonObject) Name(#RootObject)
Define_Com Class(#XPRIM_JsonArray) Name(#JsonArray)
You can then populate your JSON object or JSON array with values.
JSON data has 6 value types:

Both XPRIM_JsonObject and XPRIM_JsonArray have the following methods that each correspond to the type of value it inserts to the object or array:

Note however that the XPRIM_JsonObject's Insert methods would have a Key parameter that specifies the property name of the value to be inserted, whereas the XPRIM_JsonArray's Insert methods wouldn't have a Key parameter as it would just append the value to the end of the array.
Examples:

For example, if you have a JSON string like this, stored in a variable called '#String':
\{
    "name":      \{ 
        "given": "John",
        "surname": "Smith"
    \},
    "age": 45,
    "contactNo":
    \[
        \{ area: "02", no: "9378 2867", type: "landline" \},
        \{ no: "0468 732 371", type: "mobile" \}
    \]
\}
To parse this JSON string and read its values:
Define_Com Class(#XPRIM_JsonObject) Name(#RootObject)
Define_Com Class(#XPRIM_ErrorInfo) Name(#ErrorInfo)

If you just want to check if a JSON element is of a certain type, you can use one of the Is… method:

Next: Using XPRIM_JsonWriter to Construct JSON Strings