-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Force selected strings to marshal as string enclosed with double quotes #556
Comments
Marshaling will not quote values unless they change their meaning when unquoted. At the moment if you want to force this, you can either use yaml.Node in v3 or define an Unmarshaler interface that returns a Node with the custom styling. |
Hi @niemeyer , could you kindly provide examples? It will be helpful for other that are trying to achieve the desired result with a quick glance. Thanks for the tip on the custom Unmarshaler, it solved the problem for me |
Hello, I have a requirement where a mapping with key "key" and value as string like 12:34 should be marshalled as key: "12.34". I searched for all possible documentation but could not find it. Could you please suggest how to implement this requirement. What I tried while debugging is changing the value of "canUsePlain" in encode.go at runtime to false and it worked as expected. But there is no certain way to enforce this behavior for a selected property that I could find.
The text was updated successfully, but these errors were encountered: