0
I would like to know (understand) how to treat a json in javascript type:
var arrDados = {"mes":["12","5","1"], "mes":["2","8","3"]};
var meses = {1:'Jan', 12:'Dez', 6:'Junho', 5:'Abril', 3:'Março', 8:'Agosto', 2:'Fevereiro'}
The idea is that according to the MES index and its Array of numbers where each one indicates a month
12 => December 3 => Tides
for (i in arrDados.mes) {
indice = arrDados.mes[i];
console.log(indice);
}
So I’m only getting the values of the first json Dice
details:
arrDados
have duplicate keys... that’s invalid syntax. Are you sure JSON is like that? where does JSON come from?– Sergio
Hello @Sergio the previous time I put from that, but I will have several Json like this: {"mes":["12","5","1"]} {"mes":["10","3","2"] but I don’t really know how to do it.. I’ll show you an image
– phpricardo
Okay, you mean that variable will be
var arrDados = [{"mes":["12","5","1"]}, {"mes":["2","8","3"]}];
?– Sergio
yeah, I think that’s the right format
– phpricardo