skillfed

xmltodict

Makes working with XML feel like you are working with JSON

xmltodict Permissive license MIT Active 5,751 v1.0.4 released

Install

xmltodict on PyPI

pip

pip install xmltodict

uv

uv add xmltodict

poetry

poetry add xmltodict

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 172 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: xmltodict-1.0.4-py3-none-any.whl

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Text Processing :: Markup :: XML

About xmltodict

from the package's own PyPI description — quoted content, verbatim

xmltodict

xmltodict is a Python module that makes working with XML feel like you are working with JSON, as in this "spec":

Tests (image)

>>> print(json.dumps(xmltodict.parse("""
...  <mydocument has="an attribute">
...    <and>
...      <many>elements</many>
...      <many>more elements</many>
...    </and>
...    <plus a="complex">
...      element as well
...    </plus>
...  </mydocument>
...  """), indent=4))
{
    "mydocument": {
        "@has": "an attribute",
        "and": {
            "many": [
                "elements",
                "more elements"
            ]
        },
        "plus": {
            "@a": "complex",
            "#text": "element as well"
        }
    }
}

Namespace support

By default, xmltodict does no XML namespace processing (it just treats namespace declarations as regular node attributes), but passing process_namespaces=True will make it expand...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

xmltodict parses XML documents into Python dictionaries and converts them back to XML, treating XML structure like JSON for intuitive programmatic access.

Installs with zero runtime dependencies and low friction. Actively maintained with recent commits and 5751 GitHub stars; supports Python 3.9 through 3.14 and PyPy.

MIT license permits commercial and private use with minimal restrictions; you must include the license notice in distributions.

Usage

pip install xmltodict==1.0.4

import xmltodict
result = xmltodict.parse('<root><item>value</item></root>')
print(result)  # {'root': {'item': 'value'}}

xml_out = xmltodict.unparse({'root': {'item': 'value'}})
print(xml_out)  # <?xml version="1.0" encoding="utf-8"?><root><item>value</item></root>

Verdict: A lightweight, well-maintained XML-to-dict bridge with no dependencies, strong community adoption, and zero known vulnerabilities. Suitable for any Python 3.9+ project needing intuitive XML handling. MIT licensing poses no compliance burden.

Needs verification

  • Whether streaming mode with item_callback is suitable for your specific XML file sizes and throughput requirements
  • Performance characteristics compared to alternatives for your particular XML schema complexity
xml to dict conversionxml parsing pythonxml json-like interfacexml to dictionarystreaming xml parserxml roundtrip conversion

Similar packages