-
Hi, I have a JSON document.
So I tried: const json = YAML.parseDocument(jsonObject);
const content = YAML.stringify(
json,
{
"blockQuote": true,
"collectionStyle": "block",
"defaultKeyType": YAML.Scalar.PLAIN,
"defaultStringType": YAML.Scalar.BLOCK_LITERAL,
"doubleQuotedAsJSON": true,
"indentSeq": true
}
); But it did not work, since the output is something as: "network-2": // <--- Please note the undesired quotes on the keys! :(
"external":
"name": "network-2" I desire something as: network-2: // <--- No quotes on keys! :)
external:
name: "network-2" I tried also a lot of different combinations, but no success. Another idea could be to maybe iterate over all tree objects, and somehow force the node styles as PLAIN (I suppose), Any idea/help please? Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
How are you reading the document? It sounds like you're only interested in the data that it contains, rather than its JSON representation, so |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for the reply. Regards |
Beta Was this translation helpful? Give feedback.
How are you reading the document? It sounds like you're only interested in the data that it contains, rather than its JSON representation, so
JSON.parse()
would probably be your best choice. ThenYAML.stringify()
would only be affected by the options that you pass to it, which doesn't seem to be the case in your examples above.