Skip to main content

Flask with UltraJSON.

Project description

flask-ujson

PyPI version License

pip install flask-ujson

Flask with UltraJSON.

https://github.com/ultrajson/ultrajson

from flask import Flask, jsonify

from flask_ujson import UJSON

ultra_json = UJSON()


def create_app():
    app = Flask(__name__)
    ultra_json.init_app(app)  # Replaces the standard JSON encoder with UltraJSON

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

        https://github.com/ultrajson/ultrajson
        """
        return {"hello": "world"}

    @app.route("/jsonify")
    def using_jsonify():
        """
        jsonify is not really needed for most cases, but here's an example.
        """
        return jsonify({"hello": "world"})

    return app


if __name__ == "__main__":
    app = create_app()
    app.run(debug=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

flask_ujson-1.0.4.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

flask_ujson-1.0.4-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flask_ujson-1.0.4.tar.gz
Algorithm Hash digest
SHA256 fb04c1af1bd382156a2c29c4bd29df6ac2c7b3adc1025ecda1dcb864850ef8d2
MD5 ad704e3b2dd2461ca08cde3060478ce0
BLAKE2b-256 0218d29282fcbba19af2546c04bf2d5383bd4517cc1ce7b1c0f32e099eb9e467

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for flask_ujson-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb423e6499f2e9e8802efca8dbd00142f25a76b981170c1f8e5345bf38aee0fe
MD5 d15b4621f0a760862de78a6a97eac8dd
BLAKE2b-256 89517c9450a1314720380d92b5052751f30dd18f5032df90632903239f8e9631

See more details on using hashes here.

Provenance

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