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.3.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for xmltojson-2.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b68519bd14fbf3e28baa630b8c9116b5d3aa8976648f277a78ae3448498889a |
|
MD5 | b0df0ffd73e7df9283bf36e34706edb3 |
|
BLAKE2b-256 | e53c80df27969bfbb84425886dd4aaa71875807badd442af65ae7d652592e8ce |