Increase your FastAPI JSON response performance by 2x or more 🚄 1. Upgrade to the just released FastAPI 0.131.0 🎁 2. Declare your response model - return type ✨ With that, now @pydantic handles the JSON serialization on the Rust side 🦀 fastapi.tiangolo.com/advance…

Feb 22, 2026 · 4:49 PM UTC

24
94
1,238
351,909
Sort replies: Relevant Recent Liked
Replying to @FastAPI @pydantic
Is this faster than using ORJSONResponse as default class? Or it works in combination of it?
1
4
3,122
Faster, in fact, ORJSONResponse and UJSONResponse are now deprecated. 🔥
6
2,575
Replying to @FastAPI @pydantic
Now how much would that be if you'd used C
2
15
5,352
Replying to @FastAPI @pydantic
you have no idea how long i've been waiting for this (though i absolutely despise json)
4
3,969
Replying to @FastAPI @pydantic
this is nice man, but seems weird to have to do .
1,304
Replying to @FastAPI @pydantic
just benchmarked this - the Rust-based serialization in 0.131.0 cut our p99 from 89ms to 41ms on a response payload with nested arrays if you're not declaring response models you're missing the biggest perf win in recent FastAPI releases
3
1
110
24,817
Replying to @FastAPI @pydantic
I wrote a thread
FastAPI 0.131.0 just dropped and it is a REAL upgrade. JSON serialization now runs on Pydantic's Rust engine. I benchmarked it. The numbers are wild. 🧵
7
6,634
Replying to @FastAPI @pydantic
Do you think there could be a ruff rule to allow upgrading this effortlessly?
3
1,208
Replying to @FastAPI @pydantic
The kitchen cooked 🥂
2
1,533
Replying to @FastAPI @pydantic
This is nice ,having both my favourite languages working in sync is beautiful 😍
3
2,780
Replying to @FastAPI @pydantic
Excellent tip for FastAPI users! Boosting JSON response performance by 2x or more is a game-changer, backed by official docs. Keep optimizing!
2
43
Replying to @FastAPI @pydantic
"Fast" API Fast is the new slow🗣️🔥
2
1,079
Replying to @FastAPI @pydantic
Nice performance win. It would be great to publish p50 and p99 latency numbers plus payload size ranges so teams can estimate gains before rolling this into production APIs.
2
1,110
Replying to @FastAPI @pydantic
Amazing! Thanks for your work.
1
1,356
Replying to @FastAPI @pydantic
Nice upgrade 👌
1
1,309
Replying to @FastAPI @pydantic
Is pydantic rust extension using simd to parse json? If not, we still have some place to optimize
1
856
Replying to @FastAPI @pydantic
I've found that optimizing JSON response performance often comes down to one crucial detail: understanding how the framework processes data. By examining the flow from your app to the response, you can identify bottlenecks and make targeted improvements. Declaring response models can certainly help, but it's often just one piece of the puzzle.
2,285
Replying to @FastAPI @pydantic
Still no msgspec? Faster and far better than Pydantic. But all of FastAPI fights against it.
1
1
5,665
Replying to @FastAPI @pydantic
# This uses Pydantic's dump_json() which serializes directly to JSON # bytes in one pass (via Rust), avoiding the intermediate Python dict
115
Replying to @FastAPI @pydantic
Breaking Changes 🗑️ Deprecate ORJSONResponse and UJSONResponse. PR #14964 by @tiangolo.
103
Replying to @FastAPI @pydantic
Win benchmarks
433