Is there a way to determine the number of elements in a JSON object using JavaScript?
data =
{
name_data: {
35: {
name: "AA",
},
47: {
name: "BB",
},
48: {
name: "CC",
},
49: {
name: "DD",
}
}
}
It seems like the code data.name_data.length
is not working as expected and returns undefined. How can we correctly retrieve the number of elements in this JSON object using JavaScript?