I have nested objects within an object as such:
var parentObj = {
key1: {
a: true,
b: 2
},
key2: {
a: false,
b: 2
},
key3: {
a: true,
b: 2
}
}
I'm looking to create an array of objects from key values, if one of the values in the nested objects is true, and that also includes the keys as a [key,value]
pair as such:
parentobj = [
{
a: true,
b: 2,
c: "key1"
},
{
a: true,
b: 2,
c: "key3"
}
]