Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    You could apply the filter with a map instead of unrolling the array first with the .[] iterator? Not sure I fully understand the 2nd part of the Q though. Commented Oct 10, 2023 at 14:23
  • @steeldriver thanks that answers my question. Specifically json=$(jq --arg status "$status" --arg node "$node" 'map(select(.id == $node) += {status: $status})' <<<"$json"). Please write it up as an answer. Commented Oct 10, 2023 at 14:29