Skip to content

feature: Custom encodings for external types #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
burdiyan opened this issue Feb 18, 2025 · 0 comments
Open

feature: Custom encodings for external types #623

burdiyan opened this issue Feb 18, 2025 · 0 comments
Labels
waiting-for-go-api Waiting for go API updates (e.g. encoding/json/v2)

Comments

@burdiyan
Copy link

Is your feature request related to a problem? Please describe.
Very often one might want a custom encoding of some type they can't control to implement the Marshaler/Unmarshaler interfaces. So, normally you'd have to wrap the external type into your own type that does implement the interface, which is very annoying and makes it harder to work with those types.

Describe the solution you'd like
The newly proposed JSON v2 package in the standard library has some ideas on how to deal with this, allowing users to mass custom marshaler functions to the codecs.

This package already has a similar concept of having a common "registry" of various type-specific encode functions, but those are not exported for users to register their own encoders. It would be great to expose them as-is, or maybe implement something similar to what JSON v2 is dong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-go-api Waiting for go API updates (e.g. encoding/json/v2)
Projects
None yet
Development

No branches or pull requests

2 participants