Writes a JSON value at a path inside a document, creating the document and any missing intermediate objects when needed. Setting the root path $ replaces the whole document; setting a nested path like $.profile.name updates one field and records a new document version.
Successful mutations return an acknowledgement that identifies the affected target, the mutation effect, and commit facts when the operation changed stored state.
Examples
Store a JSON document, then read it back.
CLI
$ strata json set user $ {"age":30,"name":"alice"}
$ strata json get user $
Wire
{"key":"user","path":"$","type":"json_set","value":{"age":30,"name":"alice"}}
{"key":"user","path":"$","type":"json_get"}
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | yes | Document key. |
path | string | yes | JSON path. |
value | any | yes | JSON value. |
Plus the optional scope: branch and space (default to the session branch and the "default" space).
Returns
MutationAck<JsonWrite>.
Errors
failed_precondition.engine.runtime_closednot_found.engine.branchinvalid_argument.engine.product_spaceinvalid_argument.engine.json_document_idinvalid_argument.engine.json_pathinvalid_argument.engine.json_path_too_longinvalid_argument.engine.json_path_not_foundinvalid_argument.engine.json_path_typeinvalid_argument.engine.json_valueinvalid_argument.engine.json_document_too_largeinvalid_argument.engine.json_document_too_deepinvalid_argument.engine.json_array_too_large
Invocation
- CLI:
strata json set - Wire type:
json_set