bradjasper/django-jsonfield — pull request #27 by ross (2013-01-10 23:27:57+00:00)
Title: JSONField doesn't support django.core.seralizers, so fixtures don't work

for now this is just a unit test demonstrating/tracking down the problem. i'm looking for a solution and haven't yet found one.

the root problem is that the JSONField is written out with the python string representation of it's data rather than the django.core.seralizers serialized version (could be json, xml, yaml, ...)

not sure what will be required/if it'll be possible. going to start looking in to it now.

thought i'd send a pull request in case it's an easy/quick fix for someone more familiar with the code.

btw, it was hard to figure out what was happening here since json errors are silently swallowed at fields.py:23. that seems like problematic error handling.

example of the output (note the python __repr__ string for the "json" field)

[{"pk": 1, "model": "jsonfield.jsonmodel", "fields": {"json": "{}"}}, {"pk": 2, "model": "jsonfield.jsonmodel", "fields": {"json": "[]"}}, {"pk": 3, "model": "jsonfield.jsonmodel", "fields": {"json": 0}}, {"pk": 4, "model": "jsonfield.jsonmodel", "fields": {"json": ""}}, {"pk": 5, "model": "jsonfield.jsonmodel", "fields": {"json": false}}, {"pk": 6, "model": "jsonfield.jsonmodel", "fields": {"json": "{u'ary': [[0, 1, 2, 3, 4]], u'num': 42, u'dict': {u'k': u'v'}, u'key': u'value'}"}}]

best,
-rm