I've got a JSON looking like this (design might be wrong)
{
"Supermarkt": {
"name": "Supermarkt",
"translations": {
"trolley": "Einkaufswagen",
"vegetables": "Gemüse",
"cocoa": "Kakao",
"chocolate": "Schokolade"
},
"pronunciations": []
},
"Script1336Kidee": {
"name": "Script1336Kidee",
"translations": {
"Trojaner": "RAT",
"Laufzeit-Packer": "Magie",
"PHP": "Der letzte Dreck",
"JavaScript": "Wild-West"
},
"pronunciations": []
}
}
Which I get with a ajax call (already JSON-decoded through dataType: "json" $.ajax option):
let lessonCall = $.ajax("https://www2.htw-dresden.de/~s70357/vokabel.php/",{dataType: "json"});
lessonCall.fail((jqXHR, status, error) => {
console.log(status);
console.log(error);
});
lessonCall.done((data,status) => {
console.log(status);
console.log(data);
for (let lesson in data){
console.log(lesson);
console.log(lesson.name);
}
});
Problem is lesson.name
is undefined although console.log(data);
show the healthy data Object with the healthy subsub-Objects, but lesson seems to be just a string-like thing.
How can I iterate through my "name"
s?!