-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Labels
Comments
I think we should do this. |
Closed
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
Merged
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
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
The text was updated successfully, but these errors were encountered: