Yaml dump including JSON object
brollb opened this issue · 2 comments
brollb commented
Yaml dump of an object can include JSON syntax rather than the yaml syntax.
This can be replicated with deserialization and serialization of the following:
description: "initializes the simulation"
properties:
- fileName:
type: string
This will return:
description: initializes the simulation
properties:
- fileName: {type: string}
connec commented
Yes, by default sequences and mappings containing only scalars will be represented in flow style.
You can tell dump
to prefer nested style by passing default_flow_style: false
in the options.
yaml.dump(obj, null, null, { default_flow_style: false })
brollb commented
My mistake. After also checking out the behavior of pyYAML, (http://pyyaml.org/wiki/PyYAMLDocumentation), it makes sense why this is the default behavior.