Skip to main content

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

Downloads

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)

Uploaded Source

Built Distribution

xmltojson-2.0.2-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page