Skip to main content

Flask extension for non-basic types' serialization to JSON via jsonplus lib.

Project description

Flask extension for non-basic types’ serialization to JSON via jsonplus lib.


Install from PyPI:

pip install Flask-JSONPlus

Enable in your Flask app (probably your app/

from flask_jsonplus import FlaskJSONPlus

app = Flask(__name__)

app.config['JSONPLUS_EXACT'] = True

jsonplus = FlaskJSONPlus(app)


After you enable FlaskJSONPlus, Flask will start to use jsonplus internally for JSON (de-)serialization. For example, jsonify will properly serialize your rich data:

import datetime, fractions, decimal, collections

def api_demo():
    Point = collections.namedtuple('Point', 'x y')
    data = {
        'third': fractions.Fraction(1, 3),
        'dec': decimal.Decimal('0.1'),
        'set': set(range(3)),
        'tuple': (3, 1, 4),
        'namedtuple': Point(3, 4)
    return jsonify(data)

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask_JSONPlus-0.0.4-py2.py3-none-any.whl (3.4 kB) Copy SHA256 hash SHA256 Wheel 3.5
Flask-JSONPlus-0.0.4.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page