All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Ordered output is now the default. Elements preserve their original document order instead of being grouped by tag name. Multiple children are wrapped in
{"children": [...]}. keep_orderparameter replaced bygroup_by_tag(defaultFalse). Setgroup_by_tag=Trueto restore the old grouped behavior.- Removed deprecated aliases:
bs2json(lowercase),convertAll(),toJson()— useBS2Json,convert_all(),to_json(). - Package restructured into focused modules:
models.py,serializer.py,converter.py,extension.py. The monolithicbs2json.pyhas been removed. - Migrated from
setup.pytopyproject.toml. - Dependency changed from
bs4shim tobeautifulsoup4(the canonical package).
ConversionConfigdataclass — structured configuration object accessible viaconverter.config.group_by_tagoption — opt-in for the legacy grouped-by-tag-name output format.__repr__onBS2Jsonfor debugging friendliness.- 27 tests (up from 6).
- Class-level mutable state bug —
__labels,last_obj, andsoupwere shared across all instances, causing cross-instance corruption. convert_all()crash when called with no arguments while soup was set.include_comments=Falsenow properly excludes HTML comments (previously fell through toNavigableString).NoReturntype hints replaced with correctNonereturn type.- Ordered output with attributes — elements with attrs now consistently produce
{"attrs": {...}, "children": [...]}instead of appending attrs as a list item.
- Ability to initialize from a string (auto-parses with BeautifulSoup).
convert()accepts string element names andfind()kwargs.convert_all()withjoinparameter.include_commentsoption.stripoption for whitespace control.labels()for custom JSON key names.save()to write results to file.prettify()for pretty-printing.- Extension mode via
install()/remove(). - Context manager support.
- Returning null for tags like
<img>with no children. convertAlldefault list issue.
- Initial release.
- Basic HTML-to-JSON conversion via
BS2Json.