Product SiteDocumentation Site

7.2.2. Inserting expressions

            JSONInsertExpr ::= "insert" "json" ExprSingle "into" ExprSingle ("at" "position" ExprSingle)?
                             | "insert" "json" PairConstructor ("," Pair Constructor)* "into" ExprSingle
(for explanatory purposes, suboperands are replaced with a variable containing the result of their evaluation)
The second variant corresponds to the insertion of a statically known number of pairs:
insert json "foo" : "bar", "bar" : "foo" into $o
is defined as being equivalent to:
insert json { "foo" : "bar", "bar" : "foo" } into $o
Inserting expressions are available in two flavors (object insertion, array insertion):
Example 7.2. Inserting into an array or an object
              insert json (1, 2, 3) into $a at position 3
              insert json { "foo": 3, "bar":4 } into $o