My boss wants our team to use JQ to parse JSON files. An app I use produces JSON that I need to transform. I have a file that looks like this:
{
"Collections": [
{
"OptionGroups": [
{
"OptionGroupName": "Test1",
"Status": "in-sync"
}
],
"Version": "3.4.25",
"InstanceIdentifier": "Dev1"
},
{
"OptionGroups": [
{
"OptionGroupName": "Test2",
"Status": "in-sync"
}
],
"Version": "3.4.22",
"InstanceIdentifier": "Dev2"
}
]
}
Using JQ, when I execute this:
cat json.txt | jq -r '.Collections[].OptionGroups[].OptionGroupName, .Collections[].InstanceIdentifier, .Collections[].Version'
I get this output:
Test1
Test2
Dev1
Dev2
3.4.25
3.4.22
How do I get output that looks something like this:
Test1 Dev1 3.4.25
Test2 Dev2 3.4.22