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.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

xmltojson-2.0.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file xmltojson-2.0.3.tar.gz.

File metadata

  • Download URL: xmltojson-2.0.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Darwin/23.6.0

File hashes

Hashes for xmltojson-2.0.3.tar.gz
Algorithm Hash digest
SHA256 68a0022272adf70b8f2639186172c808e9502cd03c0b851a65e0760561c7801d
MD5 305f3c894d792ed7d7f66d3801e5edd1
BLAKE2b-256 c5bd7ff42737e3715eaf0e46714776c2ce75c0d509c7b2e921fa0f94d031a1ff

See more details on using hashes here.

File details

Details for the file xmltojson-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: xmltojson-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.7 Darwin/23.6.0

File hashes

Hashes for xmltojson-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1b68519bd14fbf3e28baa630b8c9116b5d3aa8976648f277a78ae3448498889a
MD5 b0df0ffd73e7df9283bf36e34706edb3
BLAKE2b-256 e53c80df27969bfbb84425886dd4aaa71875807badd442af65ae7d652592e8ce

See more details on using hashes here.

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