Flask with UltraJSON.
Project description
flask-ujson
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)
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.6.tar.gz
(11.3 kB
view details)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85ee2d0e7832b22c9497a5d14152553ab51b29f20c24e5ac9e0bd1ae65443e2b |
|
MD5 | 8c6397337eb0aec59e69ade1677c027b |
|
BLAKE2b-256 | 25f4ac510d49392ee5830077624d2a77f1639c83a3d05fe91cb7444e9f783955 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2de50bf793746cfa37539653c21a0baba9f6027f04274372c49cee6354ae8e9 |
|
MD5 | 65d876dcca4f8c121c83db03dc89305d |
|
BLAKE2b-256 | 0a4f3315cb20cbda2aa5a08a981b3c7e50cc6d1b171c2cbf704a4423c4db980e |