Replies: 1 comment 1 reply
-
The issue is that as far as At the moment, you have the 'deep' merge flag, so objects in the same array index will be merged together (which is what you want for file1 and file2. With file 3 however, you actually want to append the object it's index 0 to the existing array (and put it in index 1), rather than deep merge into index 0 (which is what deep merge does). As far as I can tell, there are two ways around this, either: new file3: a:
- null
- c:
- john: doe b) use 'deep' merge to merge file 1 and file 2 using the deep merge flag, then merge the result of that with file 3 using the append flag. |
Beta Was this translation helpful? Give feedback.
-
hello @mikefarah,
thanks for your answer about my first question. But i have another question. I want to merge the following files:
file1.yml
file2.yml
file3.yml
If i run a merge with
yq ea -M '. as $item ireduce({}; . *d $item)' file1.yml file2.yml file3.yml
i have the following result:I know that the result is a valid yaml result, but for some reasons mkdocs rise an error during the mkdocs.yml parsing. So the
wanted result is the following:
Is it possible to obtain a "-" on each entries of an array? Thanks for your help.
Regards
Lyandr
Beta Was this translation helpful? Give feedback.
All reactions