When I do json.dumps with a dictionary that maps strings to a list of unicodes, python raises a type error. Why does that not work?
+1
A:
Works fine for me in Python 2.6 (and identically in 3.1, without the u
prefix on the value):
>>> import json
>>> d={'a': u'fél'}
>>> json.dumps(d)
'{"a": "f\\u00e9l"}'
Can you please reproduce and post (by editing your answer, so you can format it properly) the tiniest bit of code that gives you the problem?
Alex Martelli
2009-12-27 04:04:32