A Python module and cli tool to quickly convert xml text or files into json
Project description
xmltojson
Python library and cli tool for converting XML to JSON
Install
$ poetry add xmltojson
$ pip install xmltojson
Usage
Command line:
Converting an XML file and sending the output to STDOUT
$ xmltojson <filename.xml>
Send output to a file
$ xmltojson <filename.xml> -o <new_filename.json>
xmltojson can also read from STDIN
$ echo '<name>John</name>' | xmltojson --stdin
Library:
[1]: import xmltojson
[2]: with open('/path/to/file', 'r') as f:
...: my_xml = f.read()
[3]: xmltojson.parse(my_xml)
'{"name": "John"}'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xmltojson-2.0.2.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for xmltojson-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ba5c8b33a5a0f824ad754ed62367d841ce91f7deaf82e118c28e42a0e24454c |
|
MD5 | 3c6ab91212108588de3754fafa808ebb |
|
BLAKE2b-256 | 4d76dd261a4c45aa3b63d57b3a854032439aa9398668a8a46e8a374b66b67069 |