[Answered ]-Django serialize function returns error JSONEncoder.__init__() got an unexpected keyword argument 'fields'

1👍

From your error traceback it can be noticed that some code in djgeojson\serializers.py is called instead of django/contrib/gis/... also as you’ve confirmed you’ve set the following in your setting:

SERIALIZATION_MODULES = {"geojson": "djgeojson.serializers"}

This means when you want Django to use a formatter with the name being "geojson" it’s going to use it from djgeojson.serializers, you can either remove that setting if you don’t use the serializer from that package or if you want to continue using it you could simply update the name you use for it:

SERIALIZATION_MODULES = {"djgeojson": "djgeojson.serializers"}

Leave a comment