Skip to main content

Indented JSON, but with one-line arrays or objects if they fit a desired line length.

Project description

JSON Reflow

Python library and CLI tool to reflow JSON files and streams, to allow a better compromise between

  • compactness: try to fit short arrays and objects on a single line, within a given line length limit
  • human readability: indented JSON for larger constructs otherwise.

The problem

Standard JSON serialization tools typically only support two extremes:

  • put everything on a single line: the most compact, but very poor for human readability

  • spread out each and every array item and object property on its own line with appropriate indentation to visualize the structure. This is easier for humans to parse visually (which is why it is often referred to as "prettifying" or "beautifying"), but for larger documents, this easily becomes unwieldy, "too vertical" and very space-inefficient because of all the repeated indentation.

JSON Reflow allows to find a better compromise: only serialize arrays or objects over multiple lines if the single-line approach would exceed a given line length.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonreflow-0.4.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonreflow-0.4.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonreflow-0.4.0.tar.gz.

File metadata

  • Download URL: jsonreflow-0.4.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsonreflow-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c817bd061126eea5ba918c0bb88597b679209ad8c27f2732d56fa7846e969c77
MD5 81cd88620153f928dd45b7afcaa34438
BLAKE2b-256 fc660b0d913b611450a0f40af0b336accf998e72113e509c4f33041cb3b564f6

See more details on using hashes here.

File details

Details for the file jsonreflow-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: jsonreflow-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for jsonreflow-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58df15a2f556847eadfab05d21e661a66eb21ca4ca533c6492afb222976a92d5
MD5 a8d24693ef5852afd6ebd373d5e2703d
BLAKE2b-256 94e7176c7791bbba18264744bc18f598af08c8658bfb84abbe5dc4e24e864861

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page