Builtin function for setting a nested object key? #231
Answered
by
anderseknert
caulagi
asked this question in
OPA and Rego
-
Hi 👋 - How can I set a specific key for a nested object? For example, if I have -
How can 'override' only the I was wondering if something like |
Beta Was this translation helpful? Give feedback.
Answered by
anderseknert
Jul 7, 2022
Replies: 1 comment 1 reply
-
You could use the updated_meta := json.patch(base_test_input, [
{"op": "replace", "path": "/resource_changes/0/change/after/metadata/foo", "value": "baz"}
]) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
caulagi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use the
json.patch
builtin function: