Skip to main content

flask-ujson

PyPI version License

pip install flask-ujson

Flask with UltraJSON.

https://github.com/ultrajson/ultrajson

from flask import Flask, request

from flask_ujson import UJSON

ultra_json = UJSON()


def create_app():
    app = Flask(__name__)
    ultra_json.init_app(app)  # Sets UltraJSON as the default JSON encoder

    @app.route("/")
    def index():
        """
        Outputs a JSON response using UltraJSON library

        https://github.com/ultrajson/ultrajson
        """
        return {
            "timestamp": 1556283673.1523004,
            "task_uuid": "0ed1a1c3-050c-4fb9-9426-a7e72d0acfc7",
            "task_level": [1, 2, 1],
            "action_status": "started",
            "action_type": "main",
            "key": "value",
            "another_key": 123,
            "and_another": ["a", "b"],
        }

    @app.post("/post")
    def accept_json():
        json = request.get_json()
        return json

    return app


if __name__ == "__main__":
    app = create_app()
    app.run(debug=True)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_ujson-1.0.6.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

flask_ujson-1.0.6-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file flask_ujson-1.0.6.tar.gz.

File metadata

  • Download URL: flask_ujson-1.0.6.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for flask_ujson-1.0.6.tar.gz
Algorithm Hash digest
SHA256 85ee2d0e7832b22c9497a5d14152553ab51b29f20c24e5ac9e0bd1ae65443e2b
MD5 8c6397337eb0aec59e69ade1677c027b
BLAKE2b-256 25f4ac510d49392ee5830077624d2a77f1639c83a3d05fe91cb7444e9f783955

See more details on using hashes here.

File details

Details for the file flask_ujson-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: flask_ujson-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for flask_ujson-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f2de50bf793746cfa37539653c21a0baba9f6027f04274372c49cee6354ae8e9
MD5 65d876dcca4f8c121c83db03dc89305d
BLAKE2b-256 0a4f3315cb20cbda2aa5a08a981b3c7e50cc6d1b171c2cbf704a4423c4db980e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

Supported by

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