-
Hey folks, My goal is checking a nested object inside an array of those objects for a specific key: value and if missing, update it. e.g. metadata:
- important:
name: Jonas
phone: 123
- lessImportant:
age: 12
objects:
- name: hello
number: 7
- name: hello2
number: 6
- name: hello
number: 2 for this document, I would like to update an object with Now my problem here is, using name: hello
number: 2
new: yes but what I need is to rewrite the original file. The Another thing I tried was merging the result with the original file, with no success as I would need a deep merge of the object I am merging but I need that for the specific array index where Any suggestions? I think I'm just missing some very simple workflow with Thanks for any answers :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Tip: You need to put brackets around the whole LHS:
I'll put this in the troubleshooting docs. Otherwise what you are doing is first filtering your yaml content, and then updating the new field |
Beta Was this translation helpful? Give feedback.
Tip: You need to put brackets around the whole LHS:
I'll put this in the troubleshooting docs.
Otherwise what you are doing is first filtering your yaml content, and then updating the new field