I have a JSON object that looks like this:
{ "a": [{ "last": "other", "b": [{ "first": "John", "last": "Doe" }] }, { "last": "other", "b": [{ "first": "Jane", "last": "Doe" }] }, { "last": "other", "b": [{ "first": "John", "last": "Smith" }] }] } I would like to use jq to turn this into a single array of objects based on the value of "last". The desired output would be something like this:
[{ "last": "Doe" }, { "last": "Smith" }] where only unique values of "last" that is a child of "b" are included. In my case I don't care about any of the other fields.