Stringify: My merge keys are surrounded with quotes "" #438
-
I attempt to stringify this object with
I get this:
But the above does not work, because |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It looks like you're trying to create a YAML alias, but you're getting a YAML scalar because the input value When working with a |
Beta Was this translation helpful? Give feedback.
It looks like you're trying to create a YAML alias, but you're getting a YAML scalar because the input value
*section
is getting escaped to avoid having it parsed as an alias. This is intentional, as otherwise the resulting YAML document would be invalid.When working with a
YAML.Document
object, you could manually create an alias withnew YAML.Alias()
and enter it into the document contents with something likedoc.setIn(['model', 0, 'cc', '<<'], ...)
, but stringifying this will fail if the document does not also include the anchor for the alias. This is why the doc.createAlias() utility method is provided, as it'll ensure that the source has an anchor matching the alias.