Skip to main content

A simple JSON and python dictionary pretty printer

Project description

jprint

A simple tool for pretty priting json strings and python dictionaries to the console.

Python Dictionary Example

from jprint import jprint


example_dict = {
    "name": "John Doe",
    "age": 30,
    "city": "New York",
    "hobbies": ["reading", "traveling", "photography"]
}

jprint(example_dict)

JSON String Example

from jprint import jprint

json_string = '''
    {
        "name": "Alice",
        "age": 32,
        "email": "alice@example.com",
        "address": {
            "street": "123 Main St",
            "city": "Los Angeles",
            "state": "CA",
            "zip": "90012"
        },
        "phone_numbers": [
            {
                "type": "home",
                "number": "555-1234"
            },
            {
                "type": "work",
                "number": "555-5678"
            }
        ]
    }
    '''

jprint(json_string, indent=2)

Json Image

Under The Covers

jprint makes use of the pygmyents library for colored output and json.dumps() for other formatting. You can pass jprint any of the parameters that you would pass to json.dumps

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

jprint-1.6.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

jprint-1.6-py3-none-any.whl (2.4 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