Skip to main content

Return pretty JSON responses from the Bottle Web Framework.

Project description

bottle-json-pretty

A plugin for the Bottle Web Framework that returns pretty formatted JSON. The plugin extends the default JSON formatter's behavior by adding the indent keyword argument to each call. This is supported by at least the standard library json, ujson, and simplejson (1, 2, 3).

Indent level and formatting during production can be controlled via the initializer.

from bottle import Bottle
from bottle_json_pretty import JSONPrettyPlugin

app = Bottle(autojson=False)
app.install(JSONPrettyPlugin(indent=2, pretty_production=True))

@app.get('/')
def bottle_test():
    return {
        'status': 'ok',
        'code': 200,
        'messages': [],
        'result': {
            'test': {
                'working': True
            }
        }
    }

app.run()

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

bottle_json_pretty-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bottle_json_pretty-0.1.0-py2.py3-none-any.whl (2.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file bottle_json_pretty-0.1.0.tar.gz.

File metadata

  • Download URL: bottle_json_pretty-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for bottle_json_pretty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e4fee81ce0113e1e2ded15c98adba4793c6c3e35cb9b306d0633bcb0d408c7c
MD5 3fb76559d308a30aa7a899b899f72726
BLAKE2b-256 ed235f565830e86b1af2e85cb9dafa217f5f9934d612738afe6c8471f30df4d5

See more details on using hashes here.

File details

Details for the file bottle_json_pretty-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: bottle_json_pretty-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for bottle_json_pretty-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3a404abac1ee46c7d654618f43e3758c83f4cf8e4c4f19090746c538c8987aad
MD5 411e7a36708ff2ac3b15b48f9d1c185b
BLAKE2b-256 6b29dbed15a9eb0b6ec95c24aec0278dfd484505dc9ab607b8f871f4acafbcd4

See more details on using hashes here.

Supported by

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