XML Encoding for JSON
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
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]}
Copyright and Licensing
Licensed under the BSD 3-Clause License.
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)
| 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
|