soup2dict
Turns your beautifulsoup4 soup into python dictionary or json
What it is and what it does
soup2dict is a lightweight wrapper that transforms parsed HTML or XML into nested Python dictionaries. It preserves document structure by mapping element tags to dictionary keys, attributes to prefixed keys (e.g., '@href'), text content to '#text' keys, and child elements to lists. The output can be serialized directly to JSON.
The package depends on beautifulsoup4 and classes. It targets Python 3.7 through 3.10 and is classified as Beta. Because the project has been abandoned since late 2021 with no maintenance activity, it will not receive updates for newer beautifulsoup4 releases or Python versions, and any bugs discovered will remain unfixed.
Use it for:
- Convert parsed HTML into JSON for REST API responses or data export pipelines.
- Transform web-scraped HTML structures into dictionaries for downstream processing or storage.
- Serialize XML documents parsed by beautifulsoup4 into nested dict format for configuration or data interchange.
- Build data transformation workflows where HTML/XML input must be normalized to dict/JSON intermediate format.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts BeautifulSoup4 parsed HTML or XML objects into Python dictionaries or JSON, preserving element hierarchy, attributes, and text content.
Yes, if you need a simple one-way HTML-to-dict converter and can tolerate an abandoned package. The code is stable (no known vulnerabilities, low install friction), but you will receive no updates if beautifulsoup4 introduces breaking changes or if you encounter edge-case bugs. Suitable for small scripts or legacy projects; avoid for new production systems where long-term maintenance is required.
Install
soup2dict on PyPI
pip
pip install soup2dictuv
uv add soup2dictpoetry
poetry add soup2dictInstalling soup2dict
Before you install
Low friction installation with a pure-Python wheel. The package is abandoned (last commit 2021-12-26) and has received no updates in over 1692 days, so expect no maintenance response to issues or compatibility problems with newer beautifulsoup4 versions.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the code provided you retain the license notice.
Quickstart
pip install soup2dict
from soup2dict import convert
from beautifulsoup4 import BeautifulSoup
soup = BeautifulSoup('<p>Hello</p>', 'html.parser')
dict_result = convert(soup)
Verify before relying
- Whether the package handles malformed HTML gracefully or what error modes occur with edge-case inputs.
- Performance characteristics when converting large or deeply nested HTML structures.
- Compatibility with beautifulsoup4 versions released after 2021-12-26.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — classes, beautifulsoup4 |
| Maintenance | abandoned — 1,692 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 97,062/month — #13,173 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: soup2dict-2.1.0-py3-none-any.whl
Keywords: beautifulsoup to dict, beautifulsoup to json, beautifulsoup4, data transformation, html to dict, xml to dict, dict, json
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
BeautifulSoupBeautiful Soup parses HTML and XML documents…
permissive · top 15,000 on PyPI
dict2xmlConverts Python dictionaries into XML strings…
permissive · top 5,000 on PyPI
markdownifyConverts HTML to Markdown, with fine-grained…
permissive · top 1,000 on PyPI
xmltojsonConverts XML documents to JSON format via a…
permissive · top 15,000 on PyPI
dicttoxmlConverts Python dictionaries and other native…
copyleft · top 5,000 on PyPI
html-to-jsonConverts HTML documents and HTML tables into…
permissive · top 15,000 on PyPI
prettierfierReformats HTML and XML strings with intelligent…
permissive · top 15,000 on PyPI
simplejsonsimplejson encodes Python objects to JSON and…
permissive · top 1,000 on PyPI
data-to-xmlConverts Python dictionaries and lists into XML…
unclear · top 15,000 on PyPI