See for yourself
>>> import pyjson
>>> pyjson.write({(1,2) : "a"})
'{[1,2]:"a"}'
>>> pyjson.read('{[1,2]:"a"}')
Traceback (most recent call last):
File "<pyshell#128>", line 1, in <module>
pyjson.read('{[1,2]:"a"}')
File "C:\Python25\lib\pyjson.py", line 309, in read
return JsonReader().read(s)
File "C:\Python25\lib\pyjson.py", line 53, in read
result = self._read()
File "C:\Python25\lib\pyjson.py", line 62, in _read
return self._readObject()
File "C:\Python25\lib\pyjson.py", line 214, in _readObject
raise ReadException, "Not a valid JSON object key (should be a string): %s" % key
ReadException: Not a valid JSON object key (should be a string): [1, 2]
So it does accept tuples as keys whilst encoding, but won't decode them anymore.
Logged In: NO
EDIT: I looked through the JSON 'specs', and it should change behaviour to throw an exception when the key is not a string. (You might even convert tuples, ints, floats etc. to a string using __repr__(), because JSON instructs us to 'be liberal in what we accept')