I'm trying to write a JQ filter allowing me to selectively filter object properties based on other of it's values.
For example, given following input
{"object1": {"Type": "Type1","Properties": {"Property1": "blablabla","Property2": [ {"Key": "Name","Value": "xxx" }, {"Key": "Surname","Value": "yyy" } ],"Property3": "xxx" }},"object2": {"Type": "Type2","Properties": {"Property1": "blablabla","Property2": [ {"Key": "Name","Value": "xxx" }, {"Key": "Surname","Value": "yyy" } ],"Property3": "xxx" } }}I would like to construct a filter, that based upon the object type, say "Type2", deletes or clears a property of that object, say Property2.The resulting output would then be:
{"object1": {"Type": "Type1","Properties": {"Property1": "blablabla","Property2": [ {"Key": "Name","Value": "xxx" }, {"Key": "Surname","Value": "yyy" } ],"Property3": "xxx" }},"object2": {"Type": "Type2","Properties": {"Property1": "blablabla","Property3": "xxx" } }}Any help greatly appreciated. Thanks in advance.