2
I have an array like the one below and would like to filter it by the property that is inside an object inside an array that is inside another object.
The idea would be to return all objects whose movements are like: "exit".
In another question on the forum I found this code and adapted it for my circumstance :) Their solution was:
var filtrado = array.filter(function(obj) { return obj.marcar == 1; });
How would I filter for moves that are like, "Exit"
var array =
[
{
conta_id : "7",
movimentações: { InternaMov : [
{data: "20/10/1029",
tipo: "saida",
valor: "300,00"},
{data: "19/10/1029",
tipo: "entrada",
valor: "900,00"}
]},
marcar : 1,
pag_data_emissao : "04/08/2015",
pag_debito_credito : "D",
pag_historico : "CHEQUE 331107 VENDA S",
pag_id : "47782",
pag_utilizado :"VENDA S",
pag_valor : "7.000,00"
},
{
conta_id : "7",
movimentações: { InternaMov : [
{data: "20/10/1029",
tipo: "saida",
valor: "300,00"},
{data: "19/10/1029",
tipo: "entrada",
valor: "900,00"}
]},
marcar : 0,
pag_data_emissao : "07/08/2015",
pag_debito_credito : "D",
pag_historico : "DEPOSITO 3117 VENDA X",
pag_id : "47783",
pag_utilizado :"VENDA X",
pag_valor : "640,63"
}
];
But you want to return only the innermost object or you want to return the information from the outer and the filtered inner object?
– Felipe Avelar