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
== bar1
but return it in this format:
{
"source_1": [
{
"val1": "foo1",
"val2": "bar1",
}
],
"source_2": [
{
"val1": "foo1",
"val2": "bar1",
}
]
}