I have the following json output
{"secrets": [ ["{"," \"name\": \"testSecret\","," \"vault-apikey\": \"kv\","," \"vault-value\": \"sabrinaTest\"","}" ] ]}
But I need the output to be a little cleaner and look like this:
{"secrets": [ [ {"name" : "testSecret","vault-apikey" : "kv","vault-value" : "sabrinaTest" } ] ]}
These are the commands that I'm currently running to get this output:
TEST_SECRET_JSON=$(hcp vault-secrets secrets open testSecret --format=json)SECRETS_INFO=$(echo $TEST_SECRET_JSON | jq -r '{"name": .name, "vault-apikey": .type, "vault-value": .static_version.value}')jq -n --arg value "${SECRETS_INFO}" '{ secrets : [ $value | split("\n") ] }'>> secret.json
I have tried other variations, but none have produced the desired results.