Anyjson

Wraps the best available JSON implementation available in a common interface
Download

Anyjson Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Rune Halvorsen
  • Publisher web site:
  • http://bitbucket.org/runeh/

Anyjson Tags


Anyjson Description

Wraps the best available JSON implementation available in a common interface Anyjson is a Python library that 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()''Conversion the other way is done with the deserialize call.>>> anyjson.deserialize("""""")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()Traceback (most recent call last): < snipped traceback >TypeError: object is not JSON encodableAnd deserializing a JSON string with invalid JSON raises a ValueError:>>> anyjson.deserialize("""['missing square brace!""")Traceback (most recent call last): ValueError: cannot parse JSON description Requirements: · Python


Anyjson Related Software