我有以下代碼:JSON序列錯誤與simplejson
data = {'services': [u'iTunes'],
'orders': [u'TestOrder', u'Test_April_Titles_iTunes'],
'providers': ''}
return HttpResponse(simplejson.dumps(data))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py" in default
178. raise TypeError(repr(o) + " is not JSON serializable")
Exception Type: TypeError at /reports/change_dropdown/
Exception Value: [u'iTunes'] is not JSON serializable
什麼我需要做的序列化此字典裏面坐了一個列表?
你正在使用什麼版本的'simplejson'?我很確定這個Unicode支持是很久以前加入的。更重要的是,爲什麼在2.7中使用'simplejson'而不是內置於stdlib,'json'的版本? – abarnert 2013-03-26 21:16:42
[SSCCE](http://SSCCE.org)。 – 2013-03-26 21:19:32