I need assistance with using the filter function in Angular.js because it's not working on objects.
Is there a way to merge a nested object into its parent using Javascript?
For example, I have the following data structure:
{
"data" : [ {
"character" : {
"realm" : 1,
"displayName" : "John",
},
"points" : 1388.0,
"wins" : 84,
"losses" : 31
}, {
"character" : {
"realm" : 1,
"displayName" : "Steven",
},
"points" : 1363.0,
"wins" : 96,
"losses" : 24
}, {
"character" : {
"realm" : 1,
"displayName" : "Mark",
},
"points" : 1322.0,
"wins" : 154,
"losses" : 43
}
]}
and I want to transform it into this format:
{
"data" : [ {
"realm" : 1,
"displayName" : "John",
"points" : 1388.0,
"wins" : 84,
"losses" : 31
}, {
"realm" : 1,
"displayName" : "Steven",
"points" : 1363.0,
"wins" : 96,
"losses" : 24
}, {
"realm" : 1,
"displayName" : "Mark",
"points" : 1322.0,
"wins" : 154,
"losses" : 43
}
]}
If you have any suggestions or solutions, please let me know!