Search code examples
pythongoogle-app-enginesimplejson

installing simplejson on the google appengine


Super nub question time! I am trying to use simplejson on the google appengine. In a terminal on my machine I have simplejson installed and working. But my when I try to import it in a script running on the appengine I get an error saying no such library exists. If open the interactive console on my machine (from the link on http://localhost:8080/_ah/admin) and type "import simplejson" I get:

Traceback (most recent call last): File "/home/chris/google_appengine/google/appengine/ext/admin/init.py", line 210, in post exec(compiled_code, globals()) File "", line 1, in ImportError: No module named simplejson

Any thoughts?


Solution

  • Look in django package:

    from django.utils import simplejson as json
    obj = json.loads(json_string)
    

    Since Sdk 1.4.2 Json can be imported with the following statement:

    import simplejson
    

    Note that on Python 2.7 runtime you can use the native Json library.