Product SiteDocumentation Site

2.2. JSONiq values

JSONiq manipulates sequences of these building blocks, which are called items. Hence, a JSONiq value is a sequence of items.
Any JSONiq expression takes and returns sequences of items.
Comma-separated JSON-like building blocks is all you need to begin building your own sequences. You can mix and match!
Example 2.1. A sequence
  "foo", 2, true, { "foo", "bar" }, null, [ 1, 2, 3 ]
Result (run with Zorba):
foo 2 true foo bar null [ 1, 2, 3 ]

Sequences are flat and cannot be nested. This makes streaming possible, which is very powerful.
Example 2.2. Sequences are flat
  ( ("foo", 2), ( (true, 4, null), 6 ) )
Result (run with Zorba):
foo 2 true 4 null 6

A sequence can be empty. The empty sequence can be constructed with empty parentheses.
Example 2.3. The empty sequence
Result (run with Zorba):

A sequence of just one item is considered the same as just this item. Whenever we say that an expression returns or takes one item, we really mean that it takes a singleton sequence of one item.
Example 2.4. A sequence of one item
Result (run with Zorba):

JSONiq classifies the items mentioned above in two categories: