Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 584

Filtering nested objects using JQ

$
0
0

For a given json:

{"source_1": [    {"val1": "foo1","val2": "bar1"    },    {"val1": "foo2","val2": "bar2"    }  ],"source_2": [    {"val1": "foo1","val2": "bar1"    },    {"val1": "foo3","val2": "bar3"    }  ]}

I would like to search it recursively where val2 equals bar1 but return it in this format:

{"source_1": [    {"val1": "foo1","val2": "bar1"    }  ],"source_2": [    {"val1": "foo1","val2": "bar1"    }  ]}

Viewing all articles
Browse latest Browse all 584

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>