Skip to content
brianburwell11 edited this page Jun 21, 2022 · 7 revisions

Module prettier_json

prettier-json

made-with-python Code style: black Github release Documentation

Generate prettier and more compact JSON dumps

Installation

prettier_json can be installed directly from the GitHub repository using one of these commands:

pip install git+ssh://git@github.com/brianburwell11/prettier-json.git@master
poetry add git+ssh://git@github.com/brianburwell11/prettier-json.git#master

Usage

Functions

basictype2str(obj) :

getsubitems(obj, itemkey, islast, maxlinelength, indent) :

indentitems(items, indent, level) : Recursively traverses the list of json lines, adds indentation based on the current depth

prettyjson(obj, indent=2, maxlinelength=80) : Renders JSON content with indentation and line splits/concatenations to fit maxlinelength. Only dicts, lists and basic types are supported

Clone this wiki locally