Structured items in JSONiq do not follow the XQuery 3.1 standard but are specific to JSONiq.
In JSONiq, an object represents a JSON object, i.e., a collection of string/items pairs.
Objects have the following property:
pairs. A set of pairs. Each pair consists of an atomic value of type xs:string and of an item.
[ Consistency constraint: no two pairs have the same name (using fn:codepoint-equal). ]
The XQuery data model uses accessors to explain the data model. Accessors are not exposed to the user and are only used for convenience in this specification. Objects have the following accessors:
jdm:object-keys($o as js:object) as xs:string*: returns all keys in the object $o.
jdm:object-value($o as js:object, $s as xs:string) as js:item: returns the value associated with $s in the object $o.
An object does not have a typed value.
In JSONiq, an array represents a JSON array, i.e., a ordered list of items.
Objects have the following property:
members. An ordered list of items.
Arrays have the following accessors:
jdm:array-size($a as js:array) as xs:nonNegativeInteger: returns the number of values in the array $a.
jdm:array-value($a as js:array, $i as xs:positiveInteger) as js:item: returns the value at position $i in the array $a..
An array does not have a typed value.
Unlike in the XQuery 3.1 standard, the values in arrays and objects are single items (which disallows the empty sequence or a sequence of more than one item). Also, object keys must be strings (which disallows any other atomic value).