Skip to main content

A json pretty printer for python

Project description

pprintjson

PyPi release Downloads

A json pretty printer for Python 🐍.

Installation

$ pip install pprintjson

Usage

usage: pprintjson.py [-h] [-i num] [-o file] [-s cmd] [-v] [file]

A pretty-printing function for json.

positional arguments:
  file                    file to json pretty-print

optional arguments:
  -h, --help              show this help message and exit
  -i num, --indent num    indent <num> number of spaces at each level (default: 4)
  -o file, --output file  write output to <file> instead of stdout (default: stdout)
  -s cmd, --string cmd    string to json pretty-print
  -v, --version           show program's version number and exit
# 1. import the "pprintjson" function.
from pprintjson import pprintjson as ppjson

# 2. pretty print JSON.
obj = { "a": 1, "b": "string", "c": True }

ppjson(obj)

stdout

License

MIT © Travis Clarke

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

pprintjson-1.1.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

pprintjson-1.1.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

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