Skip to main content

XML Encoding for JSON

https://badge.fury.io/py/xson.svg https://travis-ci.org/renatahodovan/xson.svg?branch=master https://coveralls.io/repos/github/renatahodovan/xson/badge.svg?branch=master

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-compatible with Python’s standard JSON package.

Requirements

  • Python >= 3.4

  • pip and setuptools Python packages (the latter is automatically installed by pip)

Install

The quick way:

pip install xson

Alternatively, by cloning the project and running setuptools:

python setup.py install

Usage

Example:

>>> import xson
>>> out = xson.dumps({'foo': 42, 'bar': [3.14, 'baz', True, None]}, indent=4)
>>> print(out)
<?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]}

Metadata

Release files for xson 1.0.1

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.0.1
File Size Uploaded
xson-1.0.1.tar.gz 12.2 kB Details

Release files / xson-1.0.1.tar.gz

Download URL xson-1.0.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20aa2602634f6f6fbd627532301ba5d8754ce8df15c02f4c69d1544ebb2e300b
BLAKE2b-256 checksum
How to use checksums
e315200cf92104ee039dc9aae7480544218d112bb5e17cb0bc27066614c581f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.4.8

Release history Release notifications | RSS feed

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

1 release file

This release

1.0.1 This release

1 release file

1.0.0

1 release file

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