It seems a pretty basic need, but I can't find it in the tutorial
Imagine we got an object like:
{"data":[
{"prop1":"a", "prop2":"b", "prop3":"c", "prop4":"d", "nestedprops":{"nestedprop1":"A","nestedprop2":"B"} },
{"prop2":"b", "prop3":"c", "nestedprops":{"nestedprop1":"A"}},
{"prop3":"c"}
]}
I just want the exact same json, but filtering out prop3,prop4 and nestedprop2, or in other words, I want to filter in the whole tree for prop1, prop2 and nestedprop1
{"data":[
{"prop1":"a", "prop2":"b", "nestedprops":{"nestedprop1":"A"} },
{"prop2":"b", "nestedprops":{"nestedprop1":"A"}},
{}
]}
I'm trying with jq '.data[] | {prop1,prop2,nestedprops:{nestedprop1}}' and the like but I can't find it