Skip to content
This repository
Browse code

simplejson has been deprecated in Django 1.5+

The built-in json module (Python 2.6+) is imported first and falls back to a
django.utils.simplejson import for earlier versions of Django.
  • Loading branch information...
commit 5a9c18f35d8e599748854d7bf1eee8eb30cf4238 1 parent b8be0dd
Byron Ruth authored March 23, 2013

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  restlib2/serializers/_json.py
10  restlib2/serializers/_json.py
... ...
@@ -1,5 +1,9 @@
1  
-from django.core.serializers.json import simplejson, DjangoJSONEncoder
2  
-
  1
+try:
  2
+    import json
  3
+# Implies Python < 2.6
  4
+except ImportError:
  5
+    from django.utils import simplejson as json
  6
+from django.core.serializers.json import DjangoJSONEncoder
3 7
 
4 8
 class JSON(object):
5 9
     """Very basic JSON representation encode/decoder. Additional Python types
@@ -7,7 +11,7 @@ class JSON(object):
7 11
     date and time objects.
8 12
     """
9 13
     encoder_class = DjangoJSONEncoder
10  
-    decoder_class = simplejson.JSONDecoder
  14
+    decoder_class = json.JSONDecoder
11 15
 
12 16
     encode_options = {}
13 17
     decode_options = {}

0 notes on commit 5a9c18f

Please sign in to comment.
Something went wrong with that request. Please try again.