I need to know how many containers an object has with javascript, I can count the properties in general but I can't count only those of the "Containers" parameter
below I put an array similar to what I need where I have 4 properties and one of them is containers, so I want to count how many containers there are
[
{
"depositoId": 47,
"idLugarRecepcionCargar": 119,
"idPuertoDestinoFinal": 87,
"Contenedores":[
{
"numeroContenedor": "GESU9586507",
"tipoContenedorId": 1,
"Temperatura": "3.5",
"MedidaTemp": "C",
"Ventilacion": "15.000",
"MedidaVent": "CBM",
"ODos": null,
"CoDos": null
},
{
"numeroContenedor": "GESU9592507",
"tipoContenedorId": 1,
"Temperatura": "3.5",
"MedidaTemp": "C",
"Ventilacion": "15.000",
"MedidaVent": "CBM",
"ODos": null,
"CoDos": null
},
{
"numeroContenedor": "GESU9598707",
"tipoContenedorId": 1,
"Temperatura": "3.5",
"MedidaTemp": "C",
"Ventilacion": "15.000",
"MedidaVent": "CBM",
"ODos": null,
"CoDos": null
}
]
}
]
You could do something like this:
I hope the answer will serve you, Remember that the [0] must change as long as you expect several objects for it you can do it with a For , Greetings.