skillfed

soup2dict

Turns your beautifulsoup4 soup into python dictionary or json

soup2dict v2.1.0 97.1K downloads/30d#13,173 on PyPI6
Permissive license MIT Abandoned released

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 soup2dict

uv

uv add soup2dict

poetry

poetry add soup2dict

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

beautifulsoup to dicthtml to dictionary conversionsoup to jsonbeautifulsoup4 serializationparse html to dictxml to python dicthtml structure to json
html-parsingdata-transformationserialization

More Python Modules packages