Skip to content Skip to sidebar Skip to footer

Django Object Is Not Json Serializable Error After Upgrading Django To 1.6.5

I have a django app which was running on 1.4.2 version and working completely fine, but recently i updated it to django 1.6.5 and facing some wierd errors like below Actually i am

Solution 1:

Django 1.6 changed the serializer from pickle to json. pickle can serialize things that json can't.

You can change the value of SESSION_SERIALIZER in your settings.py to get back the behaviour from Django before version 1.6.

SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

You might want to read about session serialization in the documentation.

Solution 2:

Setting this line to settings.py will clear the error when upgraded to django 1.6 version

SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

Solution 3:

After analyzing the traceback, it seems that the JSONEncoder can not serialize the instance of your Client model. Generally, you got such error if you try to serialize a model related to other models (Many2ManyField, etc.) using json or simplejson libraries.

See this https://docs.djangoproject.com/en/dev/topics/serialization/, You can also use some 3rd-party packages such as DjangoRestFramework depending on your needs.

Post a Comment for "Django Object Is Not Json Serializable Error After Upgrading Django To 1.6.5"