Yair Lenga: jsonfold: Making Pretty-Printed JSON Compact and Readable Again in Python (opens in new tab)
Most JSON serializers force a choice between compact machine output and fully expanded pretty-printing\. This article explores a middle ground: a hybrid JSON formatter for Python that keeps nested payloads readable while still remaining compact\. Example output: \{ \"meta\": \{ \"version\": 1, \"ok\": true \}, \"ids\": \[ 1, 2, 3, 4 \], \"matrix\": \[ \[1, 2\], \[3, 4\] \] \} The article also discusses streaming formatting, bounded buffering, width-aware layout decisions, and incremental proc...
Read the original article