editing values in nested array using variables

A simple addition to your already well made attempt is all you need. Replace the | with the update assignment and optionally group into parenthesis (..). The part after |= recreates the object from . and assigns to the path on the LHS

.Statement[0] |= ( .Principal.AWS as $orig | .Principal.AWS = [$orig] + ["foo", "bar"] )
#            ^^^

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top