Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add emitting of json #941

Open
L0ric0 opened this issue Sep 18, 2020 · 1 comment
Open

Add emitting of json #941

L0ric0 opened this issue Sep 18, 2020 · 1 comment

Comments

@L0ric0
Copy link

L0ric0 commented Sep 18, 2020

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.

@kerrickstaley
Copy link

kerrickstaley commented Mar 10, 2021

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.

Also, here is a relevant StackOverflow question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants