-
-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Short Description
The library correctly parse a document with a key containing ... in it, if placed in single or double quotes. But when you stringify the obtained json, the result is a key containing ... but without quotes, so when you try to parse it again, library returns a "Unexpected scalar at node end at...".
In YAML ... is document stop token (the counterpart to ---).
To Reproduce
const YAML = require('yaml);
const parsed = YAML.parse("'... this is a test': this is the value");
const stringified = YAML.stringify(parsed);
const reparsed = YAML.parse(stringified)
Expected behaviour
Keys containing token such as "..." or "---" should be automatically placed in quotes on stringify.
Versions (please complete the following information):
- Environment: Node 18.12.1
yaml: 2.2.0
Additional context
A workaround is to specify defaultKeyType option inside stringify options to QUOTE_SINGLE or QUOTE_DOUBLE. This causes that ALL keys will be single (or double) quoted.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working