-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
YamlScalarNode with "NULL" value should be written with surrounding quotes #591
Comments
Maybe related to #304 |
I second this, especially where a key name is |
Closed
This will be fixed when the next release goes out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When manually writing out a
YamlMappingNode
withYamlScalarNode("NULL")
as a key or value, I get this:This is apparently a bad write job, given that
NULL
outside of quotes actually means null to YAML, producing a null mapping node instead ofNULL
(the string) as a key in the map.When I paste this into http://yaml-online-parser.appspot.com/, the json representation is (appropriately):
Note the change in case, because the YAML was read as null instead of as the intended string
NULL
. JSON has to surround a javascriptnull
with quotes when it appears as a property name, but consider when the null is on the value side.The emitted YAML should have been:
Note the quotes around the yaml-keyword, which then forces it to be read as a string literal by other YAML parsers:
Repro steps
Actual output
Expected output
Deserialization fails
This bug becomes a more practical problem because the deserializer fails on null keys:
The above throws an exception on deserialization unless I change
"NULL"
to"NULL2"
.If I read YAML that properly quotes the NULL, deserialization succeeds.
The text was updated successfully, but these errors were encountered: