Metadata-Version: 2.4
Name: h2j
Version: 0.1.2
Summary: Convert HTML to JSON with clean keys and CSS-like classes
Home-page: https://github.com/SimBeSim/h2j
Author: Maxim Sergeyevich Shubin and Chatty Shubin
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: beautifulsoup4>=4.9
Dynamic: license-file

# h2j

[![Tests](https://github.com/SimBeSim/h2j/actions/workflows/tests.yml/badge.svg)](https://github.com/SimBeSim/h2j/actions)

Lightweight HTML → JSON converter for Python, forked from `html-to-json` but with a cleaner and more compact style.

## ✨ Features
- Attributes stored as **`_attrs`**
- Text values stored as **`_val`** (single) or **`_vals`** (multiple)
- Class attributes normalized:  
  `"a b c"` → `"a.b.c"`
- Preserves spacing in text nodes
- 100% passing tests ✅

## 📦 Install
For now, install from GitHub:

```
pip install git+https://github.com/SimBeSim/h2j.git
```
(PyPI release coming soon!)

## 🚀 Usage
```
import h2j

html = '<div class="a b c" id="x">Hello <b>World</b></div>'
out = h2j.convert(html, capture_element_attributes=True)
print(out)
```
## Output:
```
{
  'div': [
    {
      '_attrs': {'class': 'a.b.c', 'id': 'x'},
      '_val': 'Hello ',
      'b': [{'_val': 'World'}]
    }
  ]
}

```

## 🧪 Tests

Run locally with:
```
pytest
```
## 📜 License

MIT License © 2025 Maxim Sergeyevich Shubin and Chatty Shubin



