1
How do I filter objects by the operations attribute inside json?
var data = Object
entrada_diff: "00:00:00"
entrada_hoje: "00:00:00"
entrada_jornada: "08:00:00"
entrada_status: "PENDENTE"
funcionario_cpf: "06547457656"
funcionario_cracha: "10703"
funcionario_foto: "06547457656.jpeg"
funcionario_marcacoes: "4"
funcionario_nome: "LARISSA"
jornada_total: "08:00:00"
operacoes: object
operacao1:'1',
operacao2:'2'
refeicao_diff: "00:00:00"
refeicao_jornada: "12:00:00"
refeicao_retorno: "00:00:00"
refeicao_saida: "0"
refeicao_seg: "7200"
refeicao_status: "PENDENTE"
saida_diff: "00:00:00"
saida_hoje: "00:00:00"
saida_jornada: "18:00:00"
saida_status: "PENDENTE"
__proto__: Object
,
Object
,
Object
,
Object
,
Object
,
Object
,
Object
]
var set = 'operacao1'; //filtragem
filtro = _.filter(data, function(evt) {
// return true where condition is true for any market
return _.any(evt.operacoes, function(mkt,op) {
return op == set;
});
});
I don’t see any JSON in your code. You can put an example of this JSON?
– Sergio
Put an example of JSON pf.
– Sergio