Skip to content

feature: Custom encodings for external types #623

@burdiyan

Description

@burdiyan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting-for-go-apiWaiting for go API updates (e.g. encoding/json/v2)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions