xmltojson

2.0.3 · active · verified Wed Apr 15

xmltojson is a Python module and command-line tool designed to quickly convert XML text or files into JSON format. It aims to provide a straightforward conversion mechanism for common use cases. The current stable version is 2.0.3, with releases typically focusing on stability and minor feature enhancements.

Warnings

Install

Imports

Quickstart

Demonstrates how to convert a simple XML string to JSON using the `parse` method.

import xmltojson

xml_string = '<person><name>Alice</name><age>30</age></person>'
json_output = xmltojson.parse(xml_string)

print(json_output)
# Expected output: {"person": {"name": "Alice", "age": "30"}} (exact formatting may vary)

view raw JSON →