Skip to main content
Simple UBJSON in Python
=======================

`UBJSON`_ is the universally compatible format specification for binary `JSON`_.
It's pretty and simple data format and `simpleubjson`_ aims to be also the same.

.. code-block:: python

>>> import simpleubjson
>>> ubjdata = simpleubjson.encode({'hello': 'world', 'тест': [1, 2, 3]})
>>> ubjdata
b'{Si\x08\xd1\x82\xd0\xb5\xd1\x81\xd1\x82[i\x01i\x02i\x03]SU\x05helloSi\x05world}'

:func:`simpleubjson.encode` function transforms Python objects into UBJSON
`binary` string data. To decode it back to Python objects use
:func:`simpleubjson.decode` function:

.. code-block:: python

>>> simpleubjson.decode(ubjdata)
{'hello': 'world', 'тест': [1, 2, 3]}

Moreover, you may also introspect UBJSON data via :func:`simpleubjson.pprint`
function:

.. code-block:: python

>>> simpleubjson.pprint(ubjdata)
[{]
[S] [i] [5] [hello]
[S] [i] [5] [world]
[S] [i] [8] [тест]
[[]
[i] [1]
[i] [2]
[i] [3]
[]]
[}]

This representation is a bit more human friendly than traditional hexview and
designed specially for UBJSON format.

Currently `simpleubjson` follows Draft-9 specification by default, but you
may change specification version by passing ``spec="draft-N"`` argument for
:func:`~simpleubjson.decode`, :func:`~simpleubjson.encode` and
:func:`~simpleubjson.pprint` functions.

.. _UBJSON: http://ubjson.org/
.. _JSON: http://json.org/
.. _simpleubjson: http://code.google.com/p/simpleubjson/

Changes
=======

0.7.0 (2014-06-21)
------------------

- Add support of UINT8 type for Draft-9 spec;
- Add support of CHAR type for Draft-9 spec;
- Optimize strings encoding with new types;
- Switch to BSD 2 clause license;

0.6.1 (2013-04-29)
------------------

- Fix compatibility with Python 3.x;
- Force binary strings have utf-8 charset on encoding;
- Improve UBJSON decoding performance;

0.6.0 (2013-04-10)
------------------

- Project refactoring and code cleanup;
- Raise overall performance for 100-400% times depending on test case;
- Update Draft-9 support to RC state: handle new containers markers;

0.5.0 (2012-07-07)
------------------

- Fix encoding of unsized objects;
- Fix pprinting containers with NoOp markers;
- Fix markers of integers values for Draft-9 spec;

0.4.0 (2012-06-29)
------------------

- Encode `set` and `frozenset` types;
- Experimental implementation of Draft-9 specification;
- Fix encoding of `dict` iterators;
- Support Python 3.x;

0.3.0 (2012-03-03)
------------------

- Add `simpleubjson.pprint` function to dump UBJSON data using ``[ ]``-notation;
- Allow decode standalone NoOp values;
- Encode `inf` and `-inf` values as `null`;
- Remove support of custom markers and handlers;
- Wrap `HUGE` values with `Decimal` class and encode `Decimal` instances back
to `HUGE`;

0.2.0 (2011-11-30)
------------------

- Allow decoder produce NoOp values;
- Allow to specify custom decoding/encoding handlers;
- Fix float/double values handling;

0.1.0 (2011-10-13)
------------------

- First version with support Draft-8 specification.

Metadata

Release files for simpleubjson 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simpleubjson 0.7.0
File Size Uploaded Provenance
simpleubjson-0.7.0.tar.gz 30.6 kB Without provenance Details

Release files / simpleubjson-0.7.0.tar.gz

Download URL simpleubjson-0.7.0.tar.gz
Size 30.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6014e46443616720a30fd066eb806e3aead2bf61fd89b8e10180869a4696b5a4
BLAKE2b-256 checksum
How to use checksums
9c8d614a87921e1e7aacda3b17741986e7c180227b0d95cb576a8d9b8607fa9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for simpleubjson 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page