python-rison
raw JSON → 2.0.1 verified Sat May 09 auth: no python
Python encoder/decoder for the Rison data serialization format (similar to JSON but URI-safe). Current version 2.0.1, with a modernized codebase that publishes under the `rison` package instead of the legacy `prison`. Release cadence is irregular.
pip install rison Common errors
error ModuleNotFoundError: No module named 'rison' ↓
cause The package was not installed or an older version (prison) was installed instead.
fix
Run 'pip install rison'.
error ImportError: cannot import name 'dumps' from 'rison' ↓
cause Using an outdated import pattern. The correct function is 'rison.dumps' and 'rison.loads'.
fix
Use 'import rison; rison.dumps(...)' instead of 'from rison import dumps'.
Warnings
breaking v2.0.0 renamed the PyPI package from 'prison' to 'rison' and changed the top-level import from 'prison' to 'rison'. Existing code using 'import prison' will break. ↓
fix Update imports to 'import rison' and reinstall with 'pip install rison'.
deprecated The old 'prison' package on PyPI is unmaintained and should not be used. ↓
fix Switch to 'rison' version 2.0.0 or later.
gotcha Rison does not support all Python types. For example, None is not supported and will raise an error. ↓
fix Use '~' to represent null in rison strings, or filter None values before encoding.
Imports
- rison wrong
import prisoncorrectimport rison
Quickstart
import rison
# Encode a Python dict to Rison string
obj = {"name": "test", "count": 42}
encoded = rison.dumps(obj)
print(encoded) # (name:test,count:42)
# Decode a Rison string back to Python object
decoded = rison.loads(encoded)
print(decoded) # {'name': 'test', 'count': 42}