xmltodict is a Python module that makes working with XML feel like you are working with JSON.
The module solves the problem of XML's verbosity and structural complexity by converting it into Python dictionaries that follow JSON-like conventions. It uses the fast Expat parser under the hood and provides straightforward bidirectional conversion: XML documents parse into nested dictionaries with configurable key names for attributes and text content, while dictionaries can be unparsed back into XML. The tool handles namespace processing optionally, collapsing or skipping namespaces as needed, and includes a streaming mode designed for processing large XML files with minimal memory overhead.
Developers working with XML in Python should choose this tool if they prefer dictionary-based access patterns over DOM or ElementTree APIs. It suits projects that need to consume or generate XML but want the simplicity of JSON-like data structures, particularly when handling large files where streaming mode's low memory footprint matters. The module is fast enough for command-line piping and supports caching parsed results to avoid reparsing. Roundtripping between XML and dictionaries works with the standard configuration, though some advanced features like the expand_iter keyword argument for nested lists will break this bidirectional conversion.
Issues and pull requests in the project often wait weeks or longer for a first response. Work in the issue tracker is dominated by enhancement requests and user questions rather than bug reports.