Skip to content
Advertisement

how to parse json array in django

I am new in django rest api framework and using get i am fetching the a json array whose api is this https://api.coursera.org/api/courses.v1?q=search&query=machine+learning and i am not able to parse it.Actually i want to store all the names and send them to .html file .I have used this code but didnot worked for me.

JavaScript

Advertisement

Answer

This actually has nothing to do with Django.

The way to get to the name attribute inside elements (there are actually many elements, each one has a ‘name`):

JavaScript

Update:

To display the names in a view:

Considering that you have a very basic template:

JavaScript

Inside your view, considering you already have the above code, and you stored all the names in a list called names:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement