Skip to main content

XSON

XML Encoding for JSON

https://img.shields.io/pypi/v/xson?logo=python&logoColor=white https://img.shields.io/pypi/l/xson?logo=open-source-initiative&logoColor=white https://img.shields.io/github/actions/workflow/status/renatahodovan/xson/main.yml?branch=master&logo=github&logoColor=white https://img.shields.io/coveralls/github/renatahodovan/xson/master?logo=coveralls&logoColor=white

XSON is a Python package that supports the serialization of Python objects to XML documents according to the JSONx specification (draft), as well as the deserialization of JSONx documents to Python objects. The implementation aims at being API and CLI-compatible with Python’s standard JSON package.

Requirements

Install

To use XSON in another project, it can be added to setup.cfg as an install requirement (if using setuptools with declarative config):

[options]
install_requires =
    xson

To install XSON manually, e.g., into a virtual environment, use pip:

pip install xson

The above approaches install the latest release of XSON from PyPI. Alternatively, for the development version, clone the project and perform a local install:

pip install .

Usage

API

Example:

>>> import xson
>>> out = xson.dumps({'foo': 42, 'bar': [3.14, 'baz', True, None]}, indent=4)
>>> print(out)  #doctest: +NORMALIZE_WHITESPACE
<?xml version="1.0" encoding="UTF-8"?>
<json:object xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">
    <json:number name="foo">42</json:number>
    <json:array name="bar">
        <json:number>3.14</json:number>
        <json:string>baz</json:string>
        <json:boolean>true</json:boolean>
        <json:null/>
    </json:array>
</json:object>
>>> dct = xson.loads(out)
>>> print(dct)
{'foo': 42, 'bar': [3.14, 'baz', True, None]}

CLI

A command line tool is available to validate, pretty-print, or convert between JSONx and JSON objects:

xson-tool --help

or:

python -m xson.tool --help

Metadata

Release files for xson 1.1.2

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

Source distribution (sdist)

Source distribution for xson 1.1.2
File Size Uploaded Provenance Actions
xson-1.1.2.tar.gz 18.7 kB Without provenance Details for xson-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xson 1.1.2
File Interpreter ABI Platform Actions
xson-1.1.2-py3-none-any.whl Python 3 none any Details for xson-1.1.2-py3-none-any.whl

Total release size: 28.7 kB

Release files / xson-1.1.2.tar.gz

Download URL xson-1.1.2.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
434ec2035f48ebd096a4d1381f43b02afac27c5ed38bb7e0ccb9676ba919125a
BLAKE2b-256 checksum
How to use checksums
78964fd6b6625ce1fd7006c20f685fff44b716b0c1d9c43027aee0c7dcc3782c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / xson-1.1.2-py3-none-any.whl

Download URL xson-1.1.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e4bb705a21367f1ac6b545064dc01fcb26f5199bcc9a229696b07d94246e5dd
BLAKE2b-256 checksum
How to use checksums
b2fca4d64a9920c3947c8cb3f07dd470b722b4be4f901178e8188a11d4eb1b27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for xson 1.1.2

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