Skip to content

How to update/merge object inside an array with specific key: value #983

Answered by mikefarah
strudelPi asked this question in Q&A
Discussion options

You must be logged in to vote

Tip: You need to put brackets around the whole LHS:

(.objects[] | select(.number == 2) | .new) = "yes"

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

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mikefarah
Comment options

@mikefarah
Comment options

@strudelPi
Comment options

Answer selected by strudelPi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants