Input
[{
\"tags\": [{
\"value\": \"domain:sourcing\"
},
{
jq
solution:
jq '{domain: "-", apiname: "-"} as $o
| map([.tags[] | .value | split(":") | {(.[0]) : .[1]}] | add | $o + .)' input.json
{domain: "-", apiname: "-"} as $o
- used as a template objectThe output:
[
{
"domain": "sourcing",
"apiname": "src1"
},
{
"domain": "-",
"apiname": "fin1"
},
{
"domain": "fin1",
"apiname": "-"
}
]