yaml-cpp
yaml-cpp copied to clipboard
Add emitting of json
trafficstars
Add emition of json that keaps the types of the build in onjects.
I know that it is possible to emmit valid json with something like: emitter << YAML::DoubleQuoted << YAML::Flow << ... but that converts all fields to strings when parsed to json so this:
listeners:
- address: 127.0.0.1
port: 8080
https: false
is converted to:
{"listeners": [{"address": "127.0.0.1", "port": "8080", "https": "false"}]}
which certainly is valid json but the port and https fields have changed their type from int/bool to string which is not desired.
I think the key point in this issue is that it's not clear whether the behavior of YAML::DoubleQuoted as applied to numbers and booleans is intended or correct, since it changes the type of the output.