We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When encoding the go string "null", it gets encoded into the yaml value null, which is the null literal, rather than a yaml string.
"null"
null
To Reproduce
package main import ( "fmt" "github.com/goccy/go-yaml" ) func main() { originalData := map[any]any{"nullString": "null", "nullValue": nil} // this prints: // map[nullString:null nullValue:<nil>] fmt.Printf("%v\n", originalData) data, _ := yaml.Marshal(originalData) var result map[string]any // yaml document: // nullString: null // nullValue: null // but should be: // nullString: "null" // nullValue: null fmt.Println(string(data)) // after unmarshaling, we get: // map[nullString:<nil> nullValue:<nil>] yaml.Unmarshal(data, &result) fmt.Printf("%v\n", result) }
Playground Link
Expected behavior
It should encode the value as "null" rather than null. See comment in code snippet above
Version Variables
The text was updated successfully, but these errors were encountered:
@leononame hi, i just fixed your issue in this PR - #474
Sorry, something went wrong.
This problem has already been fixed with latest release. Thank you @denieryd !
No branches or pull requests
Describe the bug
When encoding the go string
"null"
, it gets encoded into the yaml valuenull
, which is the null literal, rather than a yaml string.To Reproduce
Playground Link
Expected behavior
It should encode the value as
"null"
rather thannull
. See comment in code snippet aboveVersion Variables
The text was updated successfully, but these errors were encountered: