from django.utils.functional import Promise
from django.utils.encoding import force_unicode
try:
    from simplejson import JSONEncoder
except ImportError:
    from django.utils.simplejson import JSONEncoder

class LazyEncoder(JSONEncoder):
    def default(self, obj):
        if isinstance(obj, Promise):
            return force_unicode(obj)
        return obj

@@ -90,16 +90,81 @@
 de%0Atry:%0A
+    from json import JSONEncoder%0Aexcept ImportError%0A    try:%0A    
     from
@@ -186,32 +186,36 @@
 ort JSONEncoder%0A
+    
 except ImportErr
@@ -218,16 +218,20 @@
 tError:%0A
+    
     from

use the json package from the standard library if available