我正在尝试将下面的示例yaml
文件转换为json
test.yaml
- fields: {name: "Test", nr: "000"}
model: testmodel
pk: "1"
然而,打电话
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin),
sys.stdout, indent=4)' < test.yaml > test.json
返回一个错误
"expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
in "<stdin>", line 1, column 3
expected <block end>, but found '<block mapping start>'
in "<stdin>", line 3, column 5
我的yaml档案怎么了?
发布于 2014-12-09 08:15:50
你的压痕是错的。你可能是说:
- fields: {name: "Test", nr: "000"}
model: testmodel
pk: "1"
https://stackoverflow.com/questions/27382552
复制