Let's say I have a this type of data structure:
{
"foo": [{state: on}, {state: off}, {state: on}],
"bar": [{state: off}, {state: off}, {state: on}],
"baz": [{state: on}, {state: on}, {state: on}]
}
How can I filter the nested hash arrays in an elegant way so I can get back this:
{
"foo": [{state: on}, {state: on}],
"bar": [{state: on}],
"baz": [{state: on}, {state: on}, {state: on}]
}
Code
Result