What is the best JSON library to get JSON data for Django, 'simplejson' or otherwise?
thanks very much
What is the best JSON library to get JSON data for Django, 'simplejson' or otherwise?
thanks very much
Python 2.6 comes with a json
module in the standard library -- so that would be best if you're on Python 2.6; for older Python versions, simplejson
may be roughly equivalent.
Django itself integrates simplejson
and has the ability to use your own version from the system if you have it installed.
from django.core import serializers
json_serializer = serializers.get_serializer("json")()
As Alex notes, the json
module is bundled with Python 2.6 and above -- that's actually simplejson source pulled into Python core. This might demonstrate to you that it has wide acceptance in the Python community.
The reason that you may want to use your own version is that simplejson
when compiled with C extensions and cjson
, a different module, are substantially more performant than the versions bundled with Django or Python.