Assume there is a JSON object structured like this:
"bounds":{
"coordinatetop":{
"x":143,
"y":544
},
"coordinatebottom":{
"x":140,
"y":510
}
}
Currently, I am attempting to parse the JSON using the following code. The 'data' variable represents the JSON data and 'target' is an ID tag.
$.each(data, function(index, value) {
if (typeof(value) == 'object') {
processBounds(value, target);
} else {
console.log(value);
}
});
While iterating through this code, the function call successfully retrieves values from 'coordinatetop' and 'target', extracting 'x' and 'y' values as expected. However, the function fails to iterate further to access the information stored in 'coordinatebottom'.
Are there alternative implementation methods that could help achieve this? Thank you!