xmltodict
Makes working with XML feel like you are working with JSON
Decision gist · record as of 2026-08-14
Yes. Zero dependencies, permissive MIT license, actively maintained, and ranked in the top 1000 PyPI packages by downloads. Install if you need straightforward XML↔dict conversion without schema validation overhead. No security vulnerabilities reported.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained—last commit 2026-06-15, 5751 stars, 173 days since latest release.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-02-22 (173 days) · last repo commit 2026-06-15 · 5,751 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 127,115,154 downloads/mo, #295 on PyPI
Alternatives
Verify before relying
import xmltodict
xml_string = '<root><item>value</item></root>'
result = xmltodict.parse(xml_string)
print(result) # {'root': {'item': 'value'}}
# Roundtrip back to XML
xml_output = xmltodict.unparse(result, pretty=True)
print(xml_output)- Performance characteristics compared to other XML libraries for large documents
- Exact memory footprint in streaming mode with very large XML files
What it is and what it does
xmltodict is a lightweight Python library that parses XML into dictionaries and serializes dictionaries back to XML, designed to make XML feel like JSON. It wraps Python's built-in Expat parser and provides a simple API for bidirectional conversion. Attributes become prefixed keys (default `@`), text content uses a designated key (default `#text`), and nested elements map naturally to nested dicts.
The library supports namespace processing, streaming mode for large files with callbacks, and roundtripping—converting dict → XML → dict while preserving structure. It's fast, has no external dependencies, and works across Python 3.9 through 3.14 and PyPy. Common use cases include parsing configuration files, API responses, or large data dumps without the overhead of full XML schema validation.
Use it for
- Parse XML configuration files or REST API responses into dicts for easier manipulation
- Stream large XML dumps (Wikipedia, Discogs) with item callbacks to avoid loading entire file into memory
- Convert Python dictionaries to XML for serialization or API requests
- Migrate XML-based workflows to JSON-like dict handling without rewriting parsing logic
- Command-line XML processing: pipe compressed XML through xmltodict.py to marshal objects for downstream scripts
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Zero dependencies, permissive MIT license, actively maintained, and ranked in the top 1000 PyPI packages by downloads. Install if you need straightforward XML↔dict conversion without schema validation overhead. No security vulnerabilities reported.
Install
xmltodict on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained—last commit 2026-06-15, 5751 stars, 173 days since latest release.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
import xmltodict
xml_string = '<root><item>value</item></root>'
result = xmltodict.parse(xml_string)
print(result) # {'root': {'item': 'value'}}
# Roundtrip back to XML
xml_output = xmltodict.unparse(result, pretty=True)
print(xml_output)
Verify before relying
- Performance characteristics compared to other XML libraries for large documents
- Exact memory footprint in streaming mode with very large XML files
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 173 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 127,115,154 / month, #295 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | 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 |
Evidence: xmltodict-1.0.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “streaming xml parser”
- xmltodictConverts XML to Python dictionaries and back, treating XML parsing…
- turbohtmlParse, query, edit, and serialize HTML and XML documents with a…
- et-xmlfileet_xmlfile writes large XML files with minimal memory overhead by…
Give your agent the search over MCP, or paste the wish link into any chat.
More XML packages
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.
Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.
Defusedxml hardens Python's standard XML libraries against XML bomb attacks and entity expansion exploits by providing drop-in replacements that disable dangerous parsing features by default.
Install it if your application parses any XML from untrusted sources.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
Sphinx generates professional documentation from reStructuredText source files, producing HTML, PDF, EPUB, and other formats with automatic cross-references, code highlighting, and hierarchical navigation.
Parses Atom and RSS feeds (including RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0) into Python data structures.
Install it if you need to consume RSS or Atom feeds.
See also dicttoxml · xmljson · xmltojson · xmlformatter · types-xmltodict · dict2xml · gpxpy · jxmlease · PyXB-X · xml-python