Changes between Initial Version and Version 1 of Ticket #27183, comment 6


Ignore:
Timestamp:
Apr 8, 2017, 6:06:12 PM (8 years ago)
Author:
ErikW

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27183, comment 6

    initial v1  
    33I have the field declared on my like like so:
    44
     5{{{
     6    from django.contrib.postgres.fields import JSONField
    57
    6     from django.contrib.postgres.fields import JSONField
    78    class FeedStatus(models.Model)
     9        #.....
    810        data = JSONField(default=dict)
     11        #.....
     12}}}
    913
     14When I try to access `feed_status.data` -- it returns JSON as a string (ie `"{}"` instead of `{}`}.  Each time the object is saved, the empty string is re-serialized (ie `'"\\"{}\\""'`).
    1015
    11 When I try to access `feed_status.data` -- it returns JSON as a string (ie "{}" instead of {}}.  Each time the object is saved, the empty string is re-serialized (ie '"\\"{}\\""').
    12 
    13 ```
     16{{{
    1417In 18:44:50 [30]: f = FeedStatus.objects.get(pk=25806)
    1518
     
    4346In 18:45:23 [43]: f.data
    4447Out 18:45:23 [43]: '"\\"\\\\\\"{}\\\\\\"\\""'
    45 ```
     48}}}
    4649
    4750This of course leads to incredibly bloated columns in the database (I've found some that are 10's of MB in size when they should just be a blank dict!!!)
Back to Top