Skip to main content

Json2Many

PyPI Version 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 — scenario-driven walkthrough of every feature

demo


Installation

# Library only
pip install json_to_many

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

Quick Start

Library:

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

convert() also accepts Pydantic models, dataclasses, and any object exposing to_dict() — single instances or lists, including nested fields:

from dataclasses import dataclass
from pydantic import BaseModel
from json_to_many import convert

class User(BaseModel):
    id: int
    name: str

@dataclass
class Order:
    id: int
    total: float

convert([User(id=1, name="Alice"), User(id=2, name="Bob")], "csv")
convert([Order(id=10, total=42.5)], "markdown")

Pydantic v1? Pass .dict() yourself — only v2's model_dump() is auto-detected.

CLI:

# 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:

[converters.csv]
delimiter = ";"

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

Explicit options always override the config file. See the User Guide for the full priority order and all supported keys.


Development

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 for the release process.

License

MIT — see LICENSE.

Metadata

Release files for json_to_many 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json_to_many 0.6.0
File Size Uploaded Provenance Actions
json_to_many-0.6.0.tar.gz 25.9 kB Without provenance Details for json_to_many-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for json_to_many 0.6.0
File Interpreter ABI Platform Actions
json_to_many-0.6.0-py3-none-any.whl Python 3 none any Details for json_to_many-0.6.0-py3-none-any.whl

Total release size: 67.1 kB

Release files / json_to_many-0.6.0.tar.gz

Download URL json_to_many-0.6.0.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2b93b4d86ff4405853bf2903583b5ea5cc005851130f3619610eb5c1899a537
BLAKE2b-256 checksum
How to use checksums
fd82319166c0115fb0a605d84c3a8fcc773bb07a37acce535c19f07e3279d40c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / json_to_many-0.6.0-py3-none-any.whl

Download URL json_to_many-0.6.0-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9943c0fc2b6b195763f7e6d1b84c4e2d2c2c3a38ff95af7078466e7d2edff70
BLAKE2b-256 checksum
How to use checksums
7aff0866d8b572c0aadaf4ad0ee385594b1a45d515f47a5c560645c7045f5d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Security for json_to_many 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page