Skip to main content

Flask-JSONPlus

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

Install

Install from PyPI:

pip install Flask-JSONPlus

Enable in your Flask app (probably your app/__init__.py):

from flask_jsonplus import FlaskJSONPlus

app = Flask(__name__)

app.config['JSONPLUS_EXACT'] = True

jsonplus = FlaskJSONPlus(app)

Usage

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

@app.route('/api/demo')
def api_demo():
    Point = collections.namedtuple('Point', 'x y')
    data = {
        'third': fractions.Fraction(1, 3),
        'dec': decimal.Decimal('0.1'),
        'now': datetime.datetime.now(),
        'set': set(range(3)),
        'tuple': (3, 1, 4),
        'namedtuple': Point(3, 4)
    }
    return jsonify(data)

Metadata

Release files for Flask-JSONPlus 0.0.4

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-JSONPlus 0.0.4
File Size Uploaded
Flask-JSONPlus-0.0.4.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-JSONPlus 0.0.4
File Interpreter ABI Platform
Flask_JSONPlus-0.0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 6.1 kB

Release files / Flask-JSONPlus-0.0.4.tar.gz

Download URL Flask-JSONPlus-0.0.4.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e6fffe7a41c5107f1e3f480a98860cf67e839edf4f44ad1babdb013a7ce4433f
BLAKE2b-256 checksum
How to use checksums
0aadb7033d87b3a33e2244278c8b7738e45033cd6079652d1985ad2012c32342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask_JSONPlus-0.0.4-py2.py3-none-any.whl

Download URL Flask_JSONPlus-0.0.4-py2.py3-none-any.whl
Size 3.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e71602a0052d96f87393337e074d2cd98503c7bd5f804c5330d3c0117ecfd26e
BLAKE2b-256 checksum
How to use checksums
27e5d46208877fe79c0d5a9258a3581ecf208341ad2a8096e80ea802bbb61b0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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