Python JSON module has no attribute 'dumps'

Do you have a file named json or simplejson in your path that isn't one of those two libraries? If you do, then python will load that file instead of the real library.


Turned out I had an old json library loaded from an old Python installation:

>>> import json                                                                                                                                                                                                                                                                           
>>> print json.__file__                                                                                                                                                                                                                                                                   
/home/areynolds/opt/lib/python2.5/site-packages/json.pyc

Removing that old stuff fixed the issue. Thanks!


Had a similar issues, it was caused by another custom module. I named another script json.py and it turns out it tried to load the custom json.py file as a module. dumps method is obviously not available there.

Renaming the json.py script to something else (json2.py) got rid of the issue.