Python Streaming JSON Formatter That Works with Existing Serializers
A new Python tool called jsonfold offers a solution for formatting JSON data in a way that is both compact and human-readable. It acts as a filter between existing JSON serializers and the output stream, allowing for configurable formatting behavior. This tool aims to provide a middle ground between machine-optimized output and overly verbose pretty-printed JSON.
- ▪Jsonfold allows users to control the level of compactness in pretty-printed JSON output.
- ▪The tool operates directly on the pretty-printed token stream generated by existing serializers.
- ▪Jsonfold maintains the functionality of existing serializers while improving the readability of the output.
Opening excerpt (first ~120 words) tap to expand
A Streaming JSON Formatter That Works With Existing SerializersYair Lenga9 min read·3 days ago--ListenShareA Python streaming post-filter for compact, human-readable JSON with configurable formatting behavior.Built-in JSON serializers give us two choices:The default output is built for machines and optimized for efficiency. It is compact, without any extra whitespace. While technically “text”, it feels “binary” — a dense wall of brackets, quotes, commas, and braces that is painful to inspect.Press enter or click to view image in full sizeTo solve this problem many serializers provide a “Pretty-print” mode, which adds indentation, spacing around tokens and line breaks — making it readable for humans.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Medium.