compact-json
A JSON formatter that produces compact but human-readable
Decision gist · record as of 2026-08-14
Yes, if you need compact JSON formatting and can accept the aging maintenance status. The package is stable, has no known vulnerabilities, and works with current Python versions. However, the explicit deprecation notice and recommendation to migrate to fractured-json suggest this is a good time to evaluate whether that alternative better suits your long-term needs. Install only if you are comfortable with a package that receives infrequent updates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later (supports up to 3.14); package is deprecated and maintainers recommend migrating to fractured-json.
- Low install friction with three lightweight runtime dependencies (wcwidth, setuptools, importlib-resources).
- Maintenance status is aging—last release was 231 days ago—but the package is not archived and the repository remains active with 41 stars.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.
last release 2025-12-26 (231 days) · last repo commit 2025-12-26 · 41 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,069,547 downloads/mo, #4,407 on PyPI
Alternatives
Verify before relying
import json
from compact_json import Formatter
formatter = Formatter()
formatter.indent_spaces = 2
formatter.max_inline_complexity = 10
with open("input.json", "r") as f:
obj = json.load(f)
json_string = formatter.serialize(obj)
print(json_string)- Whether the aging maintenance status (231 days since last release) affects stability or compatibility with recent Python patch versions.
- Performance characteristics when formatting very large JSON files or deeply nested structures.
- Real-world adoption and whether the deprecation notice has driven users away to fractured-json.
What it is and what it does
compact-json is a JSON formatter that balances readability with compactness by applying three formatting strategies: fitting simple objects and arrays onto a single line when they are short and not deeply nested, arranging complex lists across multiple lines with several items per line, or expanding each property or array item onto its own indented line. It exposes a Formatter class with configurable properties like max_inline_length, max_inline_complexity, and indent_spaces, allowing you to tune the output to your needs. It also provides a command-line utility for formatting JSON files directly from the shell.
The package is now deprecated and its maintainers explicitly recommend migrating to fractured-json, which tracks the upstream FracturedJson .NET project. Despite the deprecation notice, compact-json remains functional and receives occasional maintenance; it supports Python 3.9 through 3.14 and has no known security vulnerabilities. The three runtime dependencies are lightweight and widely available.
Use it for
- Format API responses or configuration files to a compact but readable form for logging or debugging without the verbosity of standard pretty-printing.
- Reduce JSON file size while keeping the output human-readable for version control or data interchange.
- Configure formatting rules (line length, nesting depth, indentation) to match your project's style guide or readability preferences.
- Use the command-line tool in shell pipelines to format JSON from stdin or batch-process multiple JSON files with consistent settings.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need compact JSON formatting and can accept the aging maintenance status.
The package is stable, has no known vulnerabilities, and works with current Python versions. However, the explicit deprecation notice and recommendation to migrate to fractured-json suggest this is a good time to evaluate whether that alternative better suits your long-term needs. Install only if you are comfortable with a package that receives infrequent updates.
Install
compact-json on PyPI
Before you install
Low install friction with three lightweight runtime dependencies (wcwidth, setuptools, importlib-resources). Maintenance status is aging—last release was 231 days ago—but the package is not archived and the repository remains active with 41 stars.
Requires Python 3.9 or later (supports up to 3.14); package is deprecated and maintainers recommend migrating to fractured-json.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.
Quickstart
import json
from compact_json import Formatter
formatter = Formatter()
formatter.indent_spaces = 2
formatter.max_inline_complexity = 10
with open("input.json", "r") as f:
obj = json.load(f)
json_string = formatter.serialize(obj)
print(json_string)
Verify before relying
- Whether the aging maintenance status (231 days since last release) affects stability or compatibility with recent Python patch versions.
- Performance characteristics when formatting very large JSON files or deeply nested structures.
- Real-world adoption and whether the deprecation notice has driven users away to fractured-json.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packageswcwidthsetuptoolsimportlib-resources |
| Maintenance | Aging 231 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,069,547 / month, #4,407 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9 |
Evidence: compact_json-1.8.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “json formatter compact”
- compact-jsonFormats JSON into compact, human-readable output by fitting objects…
- flake8-jsonA Flake8 plugin that formats linting output as JSON, with options for…
- py-ubjsonEncodes and decodes data in Universal Binary JSON format, a compact…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also condense-json · xmlformatter · dmiparser · objprint · perky · jsonstreams · rison · json-flatten · jsondiff