Skip to main content

Flask-JSON

https://travis-ci.org/skozlovf/flask-json.png?branch=master

Flask-JSON is a simple extension that adds better JSON support to Flask application.

Features:

  • Works on python 2.6, 2.7, 3.3+ and Flask 0.10+.

  • More ways to generate JSON responses (comparing to plain Flask).

  • Extended JSON encoding support.

Usage

Here is fast example:

from datetime import datetime
from flask import Flask
from flask_json import FlaskJSON, JsonError, json_response, as_json

app = Flask(__name__)
FlaskJSON(app)


@app.route('/get_time')
def get_time():
    return json_response(time=datetime.utcnow())


@app.route('/get_time_and_value')
@as_json
def get_time_and_value():
    return dict(time=datetime.utcnow(), value=12)


@app.route('/raise_error')
def raise_error():
    raise JsonError(description='Example text.', code=123)


if __name__ == '__main__':
    app.run()

Responses:

GET /get_time HTTP/1.1

HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 60

{
  "status": 200,
  "time": "2015-04-14T13:17:16.732000"
}
GET /raise_error HTTP/1.1

HTTP/1.0 400 BAD REQUEST
Content-Type: application/json
Content-Length: 70

{
  "code": 123,
  "description": "Example text.",
  "status": 400
}

Documentation

Documentation is available on pythonhosted and Read the Docs.

Metadata

Release files for Flask-JSON 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-JSON 0.3.3
File Size Uploaded Provenance Actions
Flask-JSON-0.3.3.tar.gz 9.0 kB Without provenance Details for Flask-JSON-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-JSON 0.3.3
File Interpreter ABI Platform Actions
Flask_JSON-0.3.3-py2-none-any.whl Python 2 none any Details for Flask_JSON-0.3.3-py2-none-any.whl

Total release size: 18.1 kB

Release files / Flask-JSON-0.3.3.tar.gz

Download URL Flask-JSON-0.3.3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c4964b8ff9e63181674da57a6a11f8d6c521fb6c305c0c69802c99f8ef75188c
BLAKE2b-256 checksum
How to use checksums
653c69b766d348d4f696f8437690ad6338f05a3350f59b2afbd32facbe097096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.9

Release files / Flask_JSON-0.3.3-py2-none-any.whl

Download URL Flask_JSON-0.3.3-py2-none-any.whl
Size 9.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
da01c44cffe3a1904c987c9e08abee50a5aabaa5cc796b09608f8da710356b59
BLAKE2b-256 checksum
How to use checksums
b195443e309b6c38fe675f0830bd646e0de9bfd5f718de8f9e0525b6cfd016de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.9

Security for Flask-JSON 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page