Monday, June 27, 2016

how to display JSON data in template

Greetings,

How can I access and display JSON data in a template html file? I am getting the JSON data back in the javascript console as follows : 

I tried {{ jason_data }} but no luck.

Thank you!

Here is how I am returning the json data in views.py:
return HttpResponse(json_obj, content_type='application/json')

  1. Console: 
  2. [ObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObject]
    1. 0:Object
    2. 1:Object
    3. 2:Object
    4. 3:Object
    5. 4:Object
    6. 5:Object
    7. 6:Object
    8. 7:Object
    9. 8:Object
    10. 9:Object
    11. 10:Object
    12. 11:Object
    13. 12:Object
    14. 13:Object
    15. length:14
    16. __proto__:Array[0]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5742de2f-67d8-4553-bb78-25b6a9dbf9a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment