Django Serialize a JsonField, Django Rest API

Viewed 409

I have a class for example

from django.forms import JSONField

class Area(models.model):
  GeoJson = JSONField
  ...

and a serializer for the class

class AreaSerializer(serializers.ModelSerializer):
  model = Areas
  fields = ('GeoJson',
              ...    )

but when I try to get the data from my rest frame work I get this error

Object of type 'JSONField' is not JSON serializable

What am I doing wrong? it is my first time using django and I need to store GeoJson in the database so im really stuck on how to fix this issue as I dont understand why it wont work, Any help or advice is greatly appreciated.

1 Answers
Related