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 performing a local install:
pip install .
Usage
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]}
Copyright and Licensing
Licensed under the BSD 3-Clause License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xson-1.0.4.tar.gz.
File metadata
- Download URL: xson-1.0.4.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a16fbd126539fbcb7822fb689d78a681c5495aaa30d9742a9c0a6d4e7c527db
|
|
| MD5 |
1c7e86352823eee9cefa5b491fa9190a
|
|
| BLAKE2b-256 |
a8c1d0d17455b79675707e91cff6e17d0eabd85f30f87b200b6ca476a40f5984
|
File details
Details for the file xson-1.0.4-py3-none-any.whl.
File metadata
- Download URL: xson-1.0.4-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d6cab087751359b5003def7387aa26e469f4abbbf0d609af59935cc198bed60
|
|
| MD5 |
580ac0d3d6a242e96d6ab110cbb7219b
|
|
| BLAKE2b-256 |
62176c06e740c35d357aceb3181d40dba9373a0141b4b1b0a9781751228df658
|