I have some json data that looks like:
{
"a1": {
"b1": {
"c1": {...},
"c2": [...]
},
"b2": {
"c3": {...},
"c4": [...]
}
},
"a2": {
"b3": {
"c5": {...},
"c6": [...]
},
"b4": {
"c7": {...},
"c8": [...]
}
}
}
I want to convert it to:
{
"a1": {
"b1": {},
"b2": {}
},
"a2": {
"b3": {},
"b4": {}
}
}
Note that b
s are empty objects. I can get a list of b
s as arrays:
cat testjq.json | jq '. | map_values(keys)'
But can't figure out how to map it to objects.