skillfed

prison

Rison encoder/decoder

prison v0.2.1 10.1M downloads/30d#1,481 on PyPI24
Permissive license MIT Active released

What it is and what it does

This package provides a Python encoder and decoder for a data serialization format designed specifically for embedding structured data in URIs while remaining human-readable and compact. The format uses URI-safe syntax: parentheses for objects, exclamation-mark-prefixed arrays, single quotes for strings, and special tokens for literals. It expresses the same data model as JSON but produces strings that survive URI encoding with minimal bloat.

The package supports three output formats: full format with outer delimiters, object format with outer parentheses omitted, and array format with outer array markers omitted. A command-line tool converts between this format and JSON. Optional Pygments lexer support is available via an extra dependency.

Use it for:

  • Encode nested query parameters in URLs without excessive percent-encoding bloat
  • Pass structured configuration or filter data through URI query strings in web applications
  • Convert between this format and JSON in command-line pipelines
  • Syntax-highlight data in documentation or code editors via Pygments lexers

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Encodes and decodes a compact URI-friendly data serialization format that expresses the same data structures as JSON but with minimal URI encoding overhead.

Yes. The package is stable, has no known vulnerabilities, low install friction, and fills a specific niche: passing structured data through URIs compactly. Install it if you need to embed nested objects or arrays in query parameters without the verbosity of JSON or form encoding. Active repository maintenance supports continued reliability.

Install

prison on PyPI

pip

pip install prison

uv

uv add prison

poetry

poetry add prison

Installing prison

Before you install

Low install friction with a single runtime dependency (six). Actively maintained as of the last commit in 2026, though the latest release is from 2021.

License in practice

MIT license permits commercial and private use with minimal restrictions; suitable for most projects.

Quickstart

pip install prison

import prison
prison.dumps({'foo': 'bar'})
# Returns: '(foo:bar)'
prison.loads('(foo:bar)')
# Returns: {'foo': 'bar'}

Verify before relying

  • Whether the 2021 release date reflects active development or if the repository is maintained without frequent releases
  • Performance characteristics when encoding or decoding deeply nested structures

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — six
Maintenance actively maintained — 1,814 days since the last release
Last repo commit
First released
Downloads 10,090,260/month — #1,481 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prison-0.2.1-py2.py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

compact uri serializationjson alternative for urlsuri-safe data formatquery parameter encodingnested data in urisdata encoder decoder
serializationuri-encodingcli-tool

More WWW/HTTP packages