--- id: json-flatten version: "0.3.1" license: Apache License, Version 2.0 license_treatment: permissive maintenance: aging --- # json-flatten — Python functions for flattening a JSON object to a single dictionary of pairs, and unflattening that dictionary back to a JSON object License: permissive · Maintenance: aging · Downloads: 538.0K/mo ## What it is and what it does json-flatten provides two core functions: flatten() converts a nested JSON dictionary into a single-level dictionary with dot-notation keys and type suffixes (e.g., `user.age$int`), and unflatten() reverses the process. It preserves type information for integers, floats, booleans, nulls, and empty containers through suffix markers, and represents list indices using bracket notation like `items.[0]`. The package is designed for scenarios where you need to represent JSON as HTML form data or URL query parameters—contexts where nested structures don't map naturally. It handles arbitrarily nested objects and lists, including matrices and mixed nesting patterns, all without external dependencies. Use it for: - Serialize nested JSON to HTML form fields while preserving type information for round-trip conversion. - Encode complex JSON structures as URL query string parameters for API requests. - Flatten configuration objects for storage in flat key-value databases or environment variables. - Convert JSON payloads to flat dictionaries for compatibility with legacy systems expecting single-level data. - Debug and inspect deeply nested JSON by viewing all paths and values in a single flat view. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts nested JSON objects into flat key-value dictionaries and back, preserving types using suffix notation, useful for HTML forms or query string parameters. Yes, if you need JSON flattening with type preservation and have no special Python version requirements. The zero-dependency design and low install friction make it straightforward to add. However, the aging maintenance status (706 days since last release) means you should verify it handles your specific JSON structures before relying on it in production; consider forking or monitoring the repository if you need ongoing support. ## Install pip install json-flatten uv add json-flatten poetry add json-flatten ## Installing json-flatten Before you install: Low friction: no runtime dependencies, pure Python wheel. Aging maintenance status—last release was 706 days ago and repository shows no recent activity, though it remains unarchived. License in practice: Apache License 2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install json-flatten import json_flatten flat = json_flatten.flatten({"foo": {"bar": [1, True, None]}}) original = json_flatten.unflatten(flat) Verify before relying: - Whether the package handles edge cases like circular references or very deeply nested structures. - Performance characteristics on large or complex JSON structures. - Python version compatibility (requires_python is unspecified in metadata). ## Package facts - License: Apache License, Version 2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 538.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags flatten json to dictionary, json to flat key-value pairs, unflatten dictionary to json, json form serialization, nested object flattening, query string json encoding, type-preserving json flatten, json-serialization, data-transformation [View on SkillFed](https://skillfed.io/packages/json-flatten) · [View on PyPI](https://pypi.org/project/json-flatten/)