I have an array of json objects that I'd like to convert to an associative array in bash with a slight alteration to the key
{
"Parameters": [
{
"Name": "/path/user_management/api_key",
"Type": "SecureString",
"Value": "1234",
"Version": 1
},
{
"Name": "/path/user_management/api_secret",
"Type": "SecureString",
"Value": "5678",
"Version": 1
}
]
}
I know I need to use jq and sed but I just can't quite find the proper combination of doing what I'm looking for. Need to strip out "/path/user_management/" and set the remaining as the key, and use Value for value.
Trying to find a fairly clean one liner piping commands together. What I'd like to end up with is a bash associative array of something like:
myArray[api_key]="1234"
myArray[api_secret]="5678"