Reputation: 1026
I'm trying to convert the following example yaml
file into json
test.yaml
- fields: {name: "Test", nr: "000"}
model: testmodel
pk: "1"
However, calling
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin),
sys.stdout, indent=4)' < test.yaml > test.json
returns an error
"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
What's wrong with my yaml-file?
Upvotes: 3
Views: 7152
Reputation: 1910
Your indentation is wrong. You probably meant:
- fields: {name: "Test", nr: "000"}
model: testmodel
pk: "1"
Upvotes: 3