Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Better JSON support for Flask

Project Description

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


  • 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.


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

def get_time():
    return json_response(time=datetime.utcnow())

def get_time_and_value():
    return dict(time=datetime.utcnow(), value=12)

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

if __name__ == '__main__':


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

Content-Type: application/json
Content-Length: 70

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


Documentation is available on Read the Docs.

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (10.7 kB) Copy SHA256 Checksum SHA256 Source Apr 27, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting