Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install anyjson

How to install anyjson

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install anyjson
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.3.1
0.3.3Never BuiltWhy not?
0.3.1 Available View build log
0.3 Available View build log
Windows (64-bit)
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.3.1
0.3.3Never BuiltWhy not?
0.3.1 Available View build log
0.3 Available View build log
Mac OS X (10.5+)
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
Linux (32-bit)
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
Linux (64-bit)
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2.5 Available View build log
0.2.4 Available View build log
0.3.3 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.3.3 Available View build log
 
License
BSD
Imports
Lastest release
version 0.3.3 on Nov 20th, 2012

Overview

Anyjson loads whichever is the fastest JSON module installed and provides a uniform API regardless of which JSON implementation is used.

Originally part of carrot (http://github.com/ask/carrot/)

Examples

To serialize a python object to a JSON string, call the serialize function:

>>> import anyjson
>>> anyjson.serialize(["test", 1, {"foo": 3.141592}, "bar"])
'["test", 1, {"foo": 3.141592}, "bar"]'

Conversion the other way is done with the deserialize call.

>>> anyjson.deserialize("""["test", 1, {"foo": 3.141592}, "bar"]""")
['test', 1, {'foo': 3.1415920000000002}, 'bar']

Regardless of the JSON implementation used, the exceptions will be the same. This means that trying to serialize something not compatible with JSON raises a TypeError:

>>> anyjson.serialize([object()])
Traceback (most recent call last):
  <snipped traceback>
TypeError: object is not JSON encodable

And deserializing a JSON string with invalid JSON raises a ValueError:

>>> anyjson.deserialize("""['missing square brace!""")
Traceback (most recent call last):
  <snipped traceback>
ValueError: cannot parse JSON description

Contact

The module is maintaned by Rune F. Halvorsen <runefh@gmail.com>. The project resides at http://bitbucket.org/runeh/anyjson . Bugs and feature requests can be submitted there. Patches are also very welcome.

Changelog

See CHANGELOG file

License

see the LICENSE file

Subscribe to package updates

Last updated Nov 20th, 2012

Download Stats

Last month:5

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.