I have a javascript object of the form
var fruits = {
"1": {
"id": 1,
"description": "Apple",
"groupID": 0
},
"2": {
"id": 2,
"description": "Peach",
"groupID": 0
}
}
This javascript has been obtained as a JSON response after AJAX call. How do I extract the variable data (description) here? P.S. no jQuery
what I did was
for(i=0;i<fruits.length;i++){
j=i+1;
console.log(fruits[j].description);
}
it says fruits[j] is undefined.