Skip to main content

Return pretty JSON responses from the Bottle Web Framework.

Project description


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))

def bottle_test():
    return {
        'status': 'ok',
        'code': 200,
        'messages': [],
        'result': {
            'test': {
                'working': True

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.2.tar.gz (3.1 kB view hashes)

Uploaded source

Built Distribution

bottle_json_pretty-0.1.2-py2.py3-none-any.whl (3.3 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page