Skip to content

Support custom JSON serializers#945

Closed
0x12th wants to merge 1 commit into
pydantic:mainfrom
0x12th:feat/custom-json-serializer
Closed

Support custom JSON serializers#945
0x12th wants to merge 1 commit into
pydantic:mainfrom
0x12th:feat/custom-json-serializer

Conversation

@0x12th

@0x12th 0x12th commented May 15, 2026

Copy link
Copy Markdown

Adds per-client and per-request JSON serializer and deserializer hooks so callers can use libraries such as orjson. This keeps the existing default JSON behavior unchanged while allowing request bodies and response decoding to be customized independently.

Closes #259.

@0x12th 0x12th force-pushed the feat/custom-json-serializer branch 3 times, most recently from f7475ed to a5cd144 Compare May 17, 2026 11:39
@0x12th 0x12th force-pushed the feat/custom-json-serializer branch from a5cd144 to 0e2b4cd Compare May 17, 2026 11:48
@Kludex

Kludex commented May 17, 2026

Copy link
Copy Markdown
Member

I agree with the maintainer's position in the issue that motivated this PR: I don't think this is the API shape that we want to achieve.

I agree there's a problem, and I'm happy to engage in a discussion about it. Also, I'm not that sure we should treat JSON deserialization (response) as the same "thing" as JSON serialization.

@0x12th

0x12th commented May 17, 2026

Copy link
Copy Markdown
Author

I agree with the maintainer's position in the issue that motivated this PR: I don't think this is the API shape that we want to achieve.

I agree there's a problem, and I'm happy to engage in a discussion about it. Also, I'm not that sure we should treat JSON deserialization (response) as the same "thing" as JSON serialization.

Thanks, that makes sense.

I agree that request-side JSON serialization and response-side JSON decoding probably should not be treated as the same concern. I’m going to rework the PR into a smaller proposal focused only on configurable response JSON decoding, with a reduced API surface and semantics closer to the original issue discussion.

@Kludex

Kludex commented May 17, 2026

Copy link
Copy Markdown
Member

I think it's better if you can create a discussion first with the proposal, so we can discuss in there. Would that okay for you?

@0x12th

0x12th commented May 17, 2026

Copy link
Copy Markdown
Author

I think it's better if you can create a discussion first with the proposal, so we can discuss in there. Would that okay for you?

Yes, okay.

@0x12th 0x12th marked this pull request as draft May 18, 2026 14:15
@Kludex

Kludex commented Jun 9, 2026

Copy link
Copy Markdown
Member

I'll close this for the time being. I'll engage on the issue.

@Kludex Kludex closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom JSON library

2 participants