Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
On fire

Dave Druska druska

🔥
On fire
View GitHub Profile
@rouge8
rouge8 / fields.py
Created Apr 23, 2013
Django REST Framework JSON Field
View fields.py
import json
from rest_framework import serializers
class JSONField(serializers.WritableField):
def to_native(self, obj):
return json.dumps(obj)
def from_native(self, value):
return json.loads(value)