I have the json below and I'm trying to traverse to the "results" and get the question value or the incorrect answers values
{
"response_code": 0,
"results": [
{
"category": "Science & Nature",
"type": "multiple",
"difficulty": "medium",
"question": "Which part of the body does glaucoma affect?",
"correct_answer": "Eyes",
"incorrect_answers": [
"Throat",
"Stomach",
"Blood"
]
}
]
}
I can get the "response_code", "results" with the code that I wrote below
$(function() {
$.getJSON('https://opentdb.com/api.php?amount=10', function(data){
$.each(data, function(key, val) {
console.log(key +" or " + val);
});
});
});