return value

def get_db_prep_save(self, value, *args, **kwargs):
    if value == '':
        return None
if isinstance(value, dict):
    value = json.dumps(value, cls=DjangoJSONEncoder)
return super(JSONField, self).get_db_prep_save(value, *args, **kwargs)
How to store a dictionary in a Django database model's field