skillfed

xmltojson

A Python module and cli tool to quickly convert xml text or files into json

xmltojson v2.0.3 583.4K downloads/30d#5,893 on PyPI13
Permissive license Apache-2.0 DORMANT released

What it is and what it does

xmltojson is a lightweight Python library that converts XML documents into JSON strings. It wraps xmltodict to provide both a programmatic API and a command-line interface for the conversion task. The library supports reading XML from files, stdin, or direct strings, and can write output to stdout or to a file.

The package is intended for developers who need to transform XML data into JSON format as part of data processing pipelines or integration workflows. It supports Python 3.7 through 3.11 and is marked as production-stable, though development activity has slowed since its last release in October 2024.

Use it for:

  • Convert XML configuration files to JSON for use in modern web applications or APIs
  • Transform XML data exports from legacy systems into JSON for downstream processing
  • Batch convert XML documents via the command-line tool in shell scripts or CI/CD pipelines
  • Parse XML responses from SOAP or REST services and re-serialize as JSON

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts XML documents to JSON format via a Python library or command-line tool, using xmltodict as its underlying parser.

Yes, if you need straightforward XML-to-JSON conversion. The package has low install friction, no known vulnerabilities, and permissive licensing. The dormant maintenance status is acceptable for a stable, single-purpose tool, but verify that its JSON output format (which depends on xmltodict's behavior) matches your structural requirements before committing to it.

Install

xmltojson on PyPI

pip

pip install xmltojson

uv

uv add xmltojson

poetry

poetry add xmltojson

Installing xmltojson

Before you install

Low install friction with a single lightweight runtime dependency. Maintenance is dormant—last release was in October 2024, but the repository remains active and unarchived with no recent commits.

License in practice

Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions.

Quickstart

import xmltojson
with open('file.xml', 'r') as f:
    xml_content = f.read()
result = xmltojson.parse(xml_content)
print(result)

Verify before relying

  • Whether the library preserves XML attributes, namespaces, or other structural metadata in the JSON output
  • Performance characteristics on large XML files or deeply nested structures
  • Whether round-trip conversion (JSON back to XML) is supported

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — xmltodict
Maintenance dormant — 663 days since the last release
Last repo commit
First released
Downloads 583,420/month — #5,893 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: xmltojson-2.0.3-py3-none-any.whl

Keywords: json, xml, convert, converter, library

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Text Processing :: Markup :: XML

Tags

xml to json converterxml json conversion libraryparse xml to jsoncommand line xml converterxml json cli tool
data-format-conversioncli-tool

More XML packages