0
J'utilise Django 1.6. et Python 2.7Django affiche une erreur lors du vidage sur json
Mes données dict sont là.
{'username': u'My Name', u'csrf_token': <django.utils.functional.__proxy__ object at 0x7fce0fb8af90>, 'QID': '', 'question': '\xe3\x81\x8a\xe5\x85\x83\xe6\xb0\x97\xe3\x81\x9d\xe3\x81\x86\xe3\x81\xa7\xe4\xbd\x95\xe3\x82\x88\xe3\x82\x8a\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82', 'msg_inputname': '\xe3\x81\xaa\xe3\x81\x91\xe3\x82\x8c\xe3\x81\xb0\xe8\xb3\xaa\xe5\x95\x8f\xe3\x81\xa8\xe7\xad\x94\xe3\x81\x88\xe3\x82\x92\xe6\x95\x99\xe3\x81\x88\xe3\x81\xa6\xe3\x81\x8f\xe3\x81\xa0\xe3\x81\x95\xe3\x81\x84\xe3\x80\x82', 'msg_thinking': '\xe8\x80\x83\xe3\x81\x88\xe4\xb8\xad......', 'cookie': OrderedDict([('csrftoken', 'Z9vR7cwv5VtVnKCVDbMfE1DAOgaC8GCd'), ('sessionid', '2ms47xira569x8wv5dj68l9opf1g4egg')]), 'action': '', 'voiceURL': u'http://hoge.wav', 'cssname': 'main', 'media_url': '/media/'}
* Je cacher des informations secrètes
Je voudrais montrer des données JSON. Il est mon views.py
import json
return HttpResponse(json.dumps(template_dict), content_type="application/json")
Mais
TypeError at /my_url
<django.utils.functional.__proxy__ object at 0x43bdbd0> is not JSON serializable
L'erreur est survenue.
Pourriez-vous me dire comment y remédier?
Merci beaucoup! Ça marche. – shinriyo