[Django]-Django core: <django.utils.functional.__proxy__ object at ….> is not JSON serializable

8πŸ‘

βœ…

It seems that what you are trying to serialise are not strings – they are lazy translation objects (i.e. strings marked for translation, that has not been evaluated yet).

Most likely there is a line in the same file similar to this one:

from django.utils.translation import ugettext_lazy as _

to use a translation function that is not lazy (i.e. it returns translated strings and not lazy translation objects) you should change it to:

from django.utils.translation import ugettext as _

Alternatively you can force evaluation of lazy translation objects before serialising them by calling str() on them.

Leave a comment