Rune Halvorsen avatar Rune Halvorsen committed 0610a0c

Added more serializers. bumped version

Comments (0)

Files changed (2)

 Changelog
 ---------
 
-0.1: Initial release
+0.1:
+
+ * Initial release
+
+0.1.1
+
+ * Added benchmarking script
+ * Added support for more serializer modules
 
 License
 -------
 Get the best JSON encoder/decoder available on this system.
 """
 
-__version__ = "0.1"
+__version__ = "0.1.1"
 __author__ = "Rune Halvorsen <runefh@gmail.com>"
 __homepage__ = "http://bitbucket.org/runeh/anyjson/"
 __docformat__ = "restructuredtext"
     deserialize = cjson.decode
 except ImportError:
     try:
-        # Then try to find simplejson. Later versions has C speedups which
-        # makes it pretty fast.
-        import simplejson
-        serialize = simplejson.dumps
-        deserialize = simplejson.loads
-    except ImportError:
+        import jsonlib2
+        serialize = jsonlib2.read
+        deserialize = jsonlib2.write
+    except:
         try:
-            # Then try to find the python 2.6 stdlib json module.
-            import json
-            serialize = json.dumps
-            deserialize = json.loads
-        except ImportError:
+            import jsonlib
+            serialize = jsonlib.read
+            deserialize = jsonlib.write
+        except:
             try:
-                # If all of the above fails, try to fallback to the simplejson
-                # embedded in Django.
-                from django.utils import simplejson
+                # Then try to find simplejson. Later versions has C speedups
+                # which makes it pretty fast.
+                import simplejson
                 serialize = simplejson.dumps
                 deserialize = simplejson.loads
-            except:
-                raise ImportError("No json module found")
-
+            except ImportError:
+                try:
+                    import jsonpickle
+                    serialize = jsonpickle.encode
+                    deserialize = jsonpickle.decode
+                except:
+                    try:
+                        # Then try to find the python 2.6 stdlib json module.
+                        import json
+                        serialize = json.dumps
+                        deserialize = json.loads
+                    except ImportError:
+                        try:
+                            # If all of the above fails, try to fallback to
+                            # the simplejson embedded in Django.
+                            from django.utils import simplejson
+                            serialize = simplejson.dumps
+                            deserialize = simplejson.loads
+                        except:
+                            raise ImportError("No json module found")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.