Registry / web-framework / flask-json

flask-json

JSON →
library0.4.0pypypi✓ verified 30d ago

Flask-JSON is a Flask extension that provides better JSON support, including automatic JSON serialization for object instances (via __json__() method), datetime objects, and arbitrary types. The current version is 0.4.0. Development appears to be in a maintenance state with no recent releases.

web-frameworkserialization
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.2s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from flask_json import jsonify

Minimal Flask app using Flask-JSON to serialize a custom object.

from flask import Flask from flask_json import FlaskJSON, Jsonify app = Flask(__name__) json = FlaskJSON(app) class MyObject: def __init__(self, name): self.name = name def __json__(self): return {'name': self.name} @app.route('/') def index(): return Jsonify(data=MyObject('test')) if __name__ == '__main__': app.run()
Debug
Known footguns
gotchaFlask-JSON overrides Flask's default JSON encoder globally. If you need custom encoding for different parts of your app, be careful as the global override might affect other extensions or libraries.
gotchaThe __json__() method must be defined on custom objects to be serialized. If the method is missing, Flask-JSON will fall back to Flask's default encoder, which may not handle the object correctly.
deprecatedAs of Flask 2.3 and above, the `import flask.ext.json` path has been deprecated. Always use the direct import path: `from flask_json import ...`
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
26 hits · last 30 days
bytedance
6
gptbot
4
amazonbot
4
ahrefsbot
3
claudebot
3
script
1
Resources