将 JSON 转换为 YAML。将 JSON 解析为 YAML
我正在使用配置文件,因此我需要将JSON转换为YAML。例如,我有这个JSON文件:
{
"foo": "bar",
"baz": [ "qux","quxx"],
"corge": null,
"grault": 1,
"garply": true,
"waldo": "false",
"fred": "undefined",
"emptyArray": [],
"emptyObject": {},
"emptyString": ""
}
结果应该是 YAML:
foo: "bar"
baz:
- "qux"
- "quxx"
corge: null
grault: 1
garply: true
waldo: "false"
fred: "undefined"
emptyArray: []
emptyObject: {}
emptyString: ""
你能帮我吗?