Metadata-Version: 2.4
Name: minimindslab-json-flatten
Version: 0.1.0
Summary: Flatten nested JSON-like dict/list structures into deterministic dotted or bracketed path records for small config and payload inspection.
Author: MiniMindsLab
License: MIT
Keywords: json,flatten,testing,logging,inspection
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# MiniMindsLab JSON Flatten

Flatten nested JSON-like Python structures (`dict` / `list`) into deterministic path-value records.

## Features

- Deterministic traversal order for repeatable output.
- Path format with dotted keys and bracketed list indices.
- Preserves scalar leaf values exactly (`str`, `int`, `float`, `bool`, `None`, etc.).
- Handles empty dictionaries and lists consistently.
- Pure Python, standard library only.

## Installation

```bash
pip install minimindslab-json-flatten
```

## Usage

```python
from minimindslab_json_flatten import flatten_json

data = {
    "user": {
        "name": "Ada",
        "roles": ["admin", "qa"],
        "active": True,
    },
    "meta": {}
}

flat = flatten_json(data)
# {
#   'meta': {},
#   'user.active': True,
#   'user.name': 'Ada',
#   'user.roles[0]': 'admin',
#   'user.roles[1]': 'qa'
# }
```

## API

### `flatten_json(data, separator='.', root_key='', include_empty=True)`

- `data`: nested structure (`dict`, `list`, or scalar).
- `separator`: separator between dict path segments.
- `root_key`: optional prefix for all generated paths.
- `include_empty`: when `True`, empty `dict`/`list` leaves are included.

Returns a `dict[str, object]` mapping flat paths to leaf values.

## Notes

- Dict keys are converted to strings in paths.
- Dict traversal is sorted by key string representation for deterministic output.
