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.1.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for xmltojson-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21c7a62c16c2f8bfcbd8583b99b417e9179b7b2338704a44e92169acf94eebe5 |
|
MD5 | ffdf1a1094bc9b6f35da0c6977fa18e2 |
|
BLAKE2b-256 | f7bc352c95d833aa334f51df5087370c967eaf277afb42fe364ce123f2ab9044 |