1. Luke Plant
  2. semanticeditor
Issue #45 resolved

MultiSelectField doesn't like being serialised

evildmp
created an issue

There's an issue with the custom field type: https://bitbucket.org/spookylukey/semanticeditor/src/1b87456f9579/semanticeditor/fields.py#cl-26 - whenever I dump an object to JSON with this field, a null field (empty string) becomes: [u'']. Then when I load it, that has become [u"[u'']"] and eventually filthy-looking things like [u'[u\'[u"[u\\'\\']"]\']']

I am not sure what's going on there!

Comments (5)

  1. evildmp reporter

    I thought this had been resolved, but perhaps it hasn't.

    When an empty CssClass.templates attribute is first serialised to JSON, it's saved as: "[]". When it's loaded again and dumped, the JSON output is "[u'[]']". The next time round, that becomes "[u\"[u'[]']\"]".

    As far as I can tell, this escaping or whatever it is happens when the objects are loaded; when you have "[]" in the JSON and you load it, it becomes "[u'[]']".

  2. Log in to comment