json_modify(JsonDocument, Path, NewValue)
The json_modify
function returns a modified version of JsonDocument
with the key at Path replaced by NewValue.
If Path
starts with append followed by a space then the
NewValue is appended to the array referenced by Path. It is an
error if Path refers to anything other than an array.
json_modify('{}', '$.foo', 'Some "quote"')
------------------------------------------
{"foo":"Some \"quote\""}
json_modify('{ "foo" : { "bar": [40, 42] } }', 'append $.foo.bar', 99)
----------------------------------------------------------------------
{"foo":{"bar":[40,42,99]}}
json_modify('{ "foo" : { "bar": [40, 42] } }', '$.foo.bar', 99)
---------------------------------------------------------------
{"foo":{"bar":99}}