flask-orjson
A Flask JSON provider using the fast orjson library.
What it is and what it does
flask-orjson is a Flask extension that swaps out Flask's built-in JSON encoder for orjson, a third-party library optimized for fast JSON serialization. You install it, import OrjsonProvider, and assign it to your Flask app's json property in a single line. The package is thin—it exists only to bridge Flask's JSON interface with orjson's performance characteristics.
The main use case is reducing latency in Flask applications that handle significant JSON traffic. Since JSON encoding and decoding can be a bottleneck in web services, using a faster serializer can improve throughput and response times. The package is marked Production/Stable and carries no known vulnerabilities, but maintenance is dormant, so it may not track changes in Flask or orjson closely.
Use it for:
- Speed up JSON response generation in Flask APIs that handle high request volume or large JSON payloads.
- Reduce latency when parsing incoming JSON request bodies in REST endpoints.
- Replace Flask's default JSON encoder in existing applications without rewriting serialization logic.
- Improve throughput in microservices where JSON is the primary data format.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Replaces Flask's default JSON encoder with orjson, a faster JSON serialization library, to speed up JSON request parsing and response generation in Flask applications.
Yes, if you are running a Flask application and JSON performance is a measurable concern. The package is simple, low-friction to install, carries no vulnerabilities, and uses a permissive license. However, dormant maintenance means you should verify compatibility with your Flask and orjson versions before deploying to production, and be prepared to maintain a fork if Flask's JSON interface changes significantly.
Install
flask-orjson on PyPI
pip
pip install flask-orjsonuv
uv add flask-orjsonpoetry
poetry add flask-orjsonInstalling flask-orjson
Before you install
Low install friction with only two runtime dependencies (flask and orjson). Maintenance is dormant—last release was over a year ago—but the package is marked Production/Stable.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal legal friction.
Quickstart
pip install flask-orjson
from flask import Flask
from flask_orjson import OrjsonProvider
app = Flask(__name__)
app.json = OrjsonProvider(app)
Requires Python 3.8 or later and an existing Flask application to integrate with.
Verify before relying
- Actual performance improvement magnitude compared to Flask's default JSON encoder in typical workloads.
- Compatibility with recent Flask versions given dormant maintenance status.
- Whether orjson's serialization behavior is a drop-in replacement for all JSON types Flask applications typically use.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flask, orjson |
| Maintenance | dormant — 942 days since the last release |
| First released | |
| Downloads | 131,785/month — #11,574 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_orjson-2.0.0-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
ujsonUltra-fast JSON encoding and decoding in pure C…
permissive · top 1,000 on PyPI
drf-orjson-rendererProvides a high-performance JSON renderer and…
permissive · top 15,000 on PyPI
orjsonorjson is a fast JSON serialization and…
copyleft · top 1,000 on PyPI
json-numpyProvides lossless JSON encoding and decoding…
permissive · top 15,000 on PyPI
simplejsonsimplejson encodes Python objects to JSON and…
permissive · top 1,000 on PyPI
ormsgpackormsgpack is a fast MessagePack serialization…
permissive · top 1,000 on PyPI
Flask-JSONFlask-JSON adds convenient JSON response…
permissive · top 15,000 on PyPI
jsonconversionConverts arbitrary Python objects to JSON…
permissive · top 5,000 on PyPI
flask-marshmallowFlask-Marshmallow integrates Flask and…
permissive · top 5,000 on PyPI
py-ubjsonEncodes and decodes data in Universal Binary…
permissive · top 5,000 on PyPI