Your json_obj is just a collection of python data structures (dictionaries, arrays, strings, ints, etc)... it isn't JSON. You need to serialize it to a string first using DjangoJSONEncoder.
On Mon, Jun 27, 2016 at 12:41 PM, <ayshalab@gmail.com> wrote:
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')
- Console:
- [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
- 0:Object
- 1:Object
- 2:Object
- 3:Object
- 4:Object
- 5:Object
- 6:Object
- 7:Object
- 8:Object
- 9:Object
- 10:Object
- 11:Object
- 12:Object
- 13:Object
- length:14
- __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.
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/CAD4ANxUYmWLg%3DgsGrCGM0eq7js-f2SM2cF3DgApHN%2BwpLCyssw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment