I have a JSON that I am downloading from the internet. When I print the JSON using:
data = json.decode(event.response) print(json.prettify(data))
It gets printed as shown below
[{ "description: ":"This is the quiz Description. ", "day":"05", "quiz_id":13, "image":"http://shektech.org/quizapp/2019/03/basket123.png", "year":"2019", "theme":"first quiz", "month":"03" },{ "Question 1":{ "type":"multi", "anstext":"This is the answer statement for questions 1 ", "correct":"1", "ansimage":"http://shektech.org/quizapp/2019/03/backicon.png", "qheading":"Question No 1", "questtext":"Answer: 1: Question Number 1 Statement: ", "qimage":"http://shektech.org/quizapp/2019/03/B_1-1.png", "option1":"This is option 1", "hint":"The answer is 1.", "option4":"This is Option 4", "option2":"This is Option 2", "option3":"This is Option 3" } },{ "Question 2":{ "type":"multi", "anstext":"Question 2 Answer Statement: ", "correct":"4", "ansimage":"http://shektech.org/quizapp/2019/03/basket123.png", "qheading":"Question Number 2", "questtext":"Answer: 4: Statement Questions Number 1: ", "qimage":"http://shektech.org/quizapp/2019/03/B_2.png", "option1":"This is Option 1", "hint":"The answer is option 4", "option4":"This is Option 4", "option2":"This is Option 2", "option3":"This is Option 3" } }]
I have trouble retrieving the values in the code.
I tried the following code but it does not return the corresponding values:
print(data[0].quiz_id)
Is there something wrong with the JSON or am I not accessing it correctly in a table.