0

In my api the output of JSONField looks like so:

"custom_content": "{u'key': u'value', u'hej': 1.992}",

Should be:

"custom_content": {"key": "value", "hej": 1.992},

I use djangorestframework==3.1.1, jsonfield==1.0.3, Django==1.7.4, python 2.7.6

Haven't had this problem in older projects. Any ideas to why this is happening now?

UPDATE

Solved with this solution: https://stackoverflow.com/a/28200902/632182

Community
  • 1
  • 1
Christoffer
  • 7,436
  • 4
  • 40
  • 42
  • What does your serializer look like (include the `repr(TheSerializer())`)? It sounds like it's using a `CharField` instead of what you need. – Kevin Brown-Silva Apr 29 '15 at 12:41
  • Your comment made me think of the problem in a different way, and then solved the problem with this solution: http://stackoverflow.com/a/28200902/632182 Thanks a million :) – Christoffer Apr 29 '15 at 12:50

0 Answers0