Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

Update array element of a JSON array with jq

$
0
0

I have a JSON object and would like to update for example the array element "role[test09]" to "role[hello]", I don't have the index number. I have tried a few things but somehow can't figure it out.

How can I do this with jq ?

This is my JSON object.

    {"run_list": ["role[test01]","role[test09]","role[test05]"      ]    }

The updated object should look like this

    {"run_list": ["role[test01]","role[hello]","role[test05]"      ]    }

Viewing all articles
Browse latest Browse all 657

Trending Articles