Skip to content
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

Proposal: json-style custom marshalling #76

Closed
joshlf opened this issue Mar 25, 2015 · 1 comment · Fixed by #327
Closed

Proposal: json-style custom marshalling #76

joshlf opened this issue Mar 25, 2015 · 1 comment · Fixed by #327
Assignees

Comments

@joshlf
Copy link

joshlf commented Mar 25, 2015

In the json package, encoding a type which implements the Marshaler interface will cause the encoder to call the MarshalJSON method in order to encode the value. Notably, this succeeds so long as the produced output is valid JSON.

This package allows similar functionality, but restricts it to string values. It would be very nice if this were expanded so that any valid TOML were supported. To provide some motivation: @ezrosent and I ran into this issue today in trying to encode numerical values, and ended up having to use a horrible hack to work around this limitation :P

@cespare
Copy link
Collaborator

cespare commented Feb 23, 2016

I think we should do this.

@cespare cespare self-assigned this Feb 23, 2016
ebrady pushed a commit to dvln/toml that referenced this issue Oct 24, 2016
arp242 added a commit that referenced this issue Nov 16, 2021
Ass Marshaler interface with the MarhsalTOML method to specifically
target TOML. This is similar to e.g. json.Marshaler, and takes
precedence over encoding.TextMarshaler.

Fixes #76
arp242 added a commit that referenced this issue Nov 16, 2021
Ass Marshaler interface with the MarhsalTOML method to specifically
target TOML. This is similar to e.g. json.Marshaler, and takes
precedence over encoding.TextMarshaler.

Fixes #76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants