Django

Code

Ticket #7131 (closed: fixed)

Opened 7 months ago

Last modified 4 months ago

Update simplejson to 1.8.1 for better Unicode support

Reported by: jmillikin Assigned to: nobody
Milestone: 1.0 beta Component: Serialization
Version: SVN Keywords: simplejson, json, unicode
Cc: mattimustang@gmail.com Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Simplejson 1.8.1 features greatly improved Unicode support and performance over the version included in Django trunk. In particular, the version in trunk mangles astral unicode when serializing.

If it's not feasible to include the most recent version, I would be willing to backport as much as I could to Django's version if that would be preferable.

Attachments

simplejson-1.9.2.patch (2.1 kB) - added by Matthew Flanagan <mattimustang@gmail.com> on 07/21/08 23:00:38.
patch simplejson-1.9.2 to turn it into django.utils.simplejson

Change History

05/07/08 06:46:19 changed by mattimustang@gmail.com

  • cc set to mattimustang@gmail.com.
  • needs_better_patch changed.
  • has_patch set to 1.
  • needs_tests changed.
  • needs_docs changed.

+1 Except to say that simplejson 1.9.1 is out now. I'm seeing very poor performance in simplejson 1.5 in Django when it comes to using it in serving RESTful JSON data from my models. Serializing anything more than a dozen objects with a few fields becomes noticeably slow to users. Being able to take advantage of the C "speedups" in the later versions of simplejson would be very beneficial.

Just how to include the module so that users can build the C extension themselves will be tricky.

Two alternatives would be to decouple simplejson from Django as requested in #4843 or change the simplejson import in django.core.serializers.json to be:

try:
    import simplejson
except ImportError:
    from django.utils import simplejson

Either way would allow users to build their own simplejson and use it.

06/14/08 06:57:47 changed by Simon Greenhill

  • has_patch deleted.
  • stage changed from Unreviewed to Design decision needed.

07/08/08 23:36:39 changed by mtredinnick

  • stage changed from Design decision needed to Accepted.

Jacob and I had a chat about this and we'll do it at some point (moving to the latest version). What will be useful in the interim, however, is if somebody could work out what, if any, backwards incompatibilities there are between simplejson 1.5 and simplejson 1.9 that might affect Django's serialisers. Just drop a note in this ticket with any discoveries so that we can update the wiki page when we make the update.

07/21/08 22:59:58 changed by Matthew Flanagan <mattimustang@gmail.com>

  • milestone set to 1.0 beta.

I've had a look through and I can't see any backward incompatibilities and I've dropped simplejson-1.9.2 in as a replacement for django.utils.simplejson in a large application that I have that uses serialization quite heavily and I haven't had any problems. All django tests pass too.

I'll attach a patch to simplejson-1.9.2 to bring it into Django.

We should also note in the serialization docs that you can build the C _speedups.so from the original simplejson source and copy it to django/utils/simplejson to get better serialization performance.

07/21/08 23:00:38 changed by Matthew Flanagan <mattimustang@gmail.com>

  • attachment simplejson-1.9.2.patch added.

patch simplejson-1.9.2 to turn it into django.utils.simplejson

07/27/08 18:38:29 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8124]) Fixed #7131 -- Updated included simplejson code to match the simplejson-1.9.2 release. This should be fully backwards-compatible for people using the public interfaces.


Add/Change #7131 (Update simplejson to 1.8.1 for better Unicode support)




Change Properties
Action