anyjson

raw JSON →
0.3.3 verified Mon Apr 27 auth: no python deprecated

Wraps the best available JSON implementation available in a common interface. Current version 0.3.3. Unmaintained since 2012; essentially abandoned.

pip install anyjson
error ImportError: No module named anyjson
cause anyjson is not installed.
fix
pip install anyjson
error AttributeError: module 'anyjson' has no attribute 'dumps'
cause anyjson uses 'serialize' and 'deserialize', not 'dumps' and 'loads'.
fix
Use anyjson.serialize() and anyjson.deserialize().
deprecated anyjson is unmaintained and considered deprecated. Use the standard library json module instead.
fix Replace import anyjson with import json.
gotcha anyjson selects a backend at import time based on what is available. This can lead to inconsistent behavior across environments.
fix Use a specific JSON library directly (e.g., json, ujson, orjson).

Encode and decode JSON using anyjson.

import anyjson

data = {'hello': 'world'}
encoded = anyjson.serialize(data)
print(encoded)
decoded = anyjson.deserialize(encoded)
print(decoded)