Metadata-Version: 2.4
Name: json_to_many
Version: 0.4.0
Summary: A utility package to convert JSON data to multiple formats like XML, Markdown, CSV, etc.
Project-URL: Homepage, https://github.com/ananthanandanan/Json_To_Many
Project-URL: Repository, https://github.com/ananthanandanan/Json_To_Many
Project-URL: Documentation, https://github.com/ananthanandanan/Json_To_Many/tree/main?tab=readme-ov-file#quick-start
Project-URL: Bug Reports, https://github.com/ananthanandanan/Json_To_Many/issues
Author-email: ananthanandanan <ananthanandanan@gmail.com>
License: MIT License
        
        Copyright (c) 2026 K N Anantha nandanan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: converter,csv,json,markdown,xml
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: <3.13,>=3.10
Requires-Dist: tomli>=2.0; python_version < '3.11'
Provides-Extra: cli
Requires-Dist: click>=8.3.3; extra == 'cli'
Description-Content-Type: text/markdown

# Json2Many

[![PyPI Version](https://img.shields.io/pypi/v/json_to_many.svg)](https://pypi.org/project/json_to_many/)
[![License](https://img.shields.io/pypi/l/json_to_many.svg)](https://github.com/ananthanandanan/Json_To_Many/blob/main/LICENSE)

A zero-dependency Python library and CLI for converting JSON into multiple output formats.
Every conversion returns a typed `ConversionResult` — no raw string parsing, full mypy/pyright
support out of the box.

→ **[User Guide](docs/GUIDE.md)** — scenario-driven walkthrough of every feature

![demo](demo/demo.gif)

---

## Installation

```bash
# Library only
pip install json_to_many

# With CLI support
pip install 'json_to_many[cli]'
```

## Quick Start

**Library:**

```python
from json_to_many import convert

result = convert("users.json", "csv", delimiter=";")
print(result.data)
# id,name,email,score,city
# 1,Alice Nguyen,alice@example.com,8.4,London
# 2,Bob Smith,bob@example.com,7.1,Berlin
print(result.stats.rows)    # 5
```

**CLI:**

```bash
# Inspect a JSON file before converting
json2many schema api_export.json

# Convert to CSV
json2many convert api_export.json --to csv --output report.csv

# Multiple formats in one pass
json2many convert api_export.json --to csv --to html --output-dir ./dist/
```

---

## Formats

| Format | When to use | Options |
|--------|-------------|---------|
| `markdown` | Docs, wikis, changelogs | `title`, `heading_offset`, `max_heading_level`, `bullet_lists`, `table_for_lists`, `frontmatter`, `code_block_keys` |
| `xml` | Legacy system integration, data exchange | `root_element`, `item_element`, `pretty_print` |
| `csv` | Spreadsheets, analyst handoff | `delimiter`, `quotechar`, `include_header`, `columns` |
| `html` | Stakeholder reports, CI build artifacts | `title`, `table_style`, `wrap_in_page` |
| `jsonl` | Log pipelines, ML fine-tuning, streaming | `ensure_ascii` |
| `sql` | Database seeding, fixture data for tests | `table`, `include_create`, `batch_size` |

---

## Project Config

Add `.json2many.toml` at your project root to share converter settings across a team:

```toml
[converters.csv]
delimiter = ";"

[converters.xml]
pretty_print = true
root_element = "records"
```

Explicit options always override the config file. See the [User Guide](docs/GUIDE.md) for the
full priority order and all supported keys.

---

## Development

```bash
uv sync --extra cli --dev       # install runtime, CLI, and dev tooling
uv run pre-commit install       # install Git hooks
uv run pre-commit run --all-files
uv run pytest
```

The pre-commit setup runs Ruff lint fixes, Ruff formatting, YAML validation, trailing whitespace
cleanup, and final newline checks. Ruff is pinned through both `pyproject.toml` and
`.pre-commit-config.yaml`; keep those versions aligned when upgrading the formatter.

> **Maintainers:** See [RELEASING.md](RELEASING.md) for the release process.

## License

MIT — see [LICENSE](LICENSE).
