DevToys
DevToys copied to clipboard
JSON <> YAML tool converts JSON strings that contain numbers into YAML numbers
Description
Converting a JSON file that contains a number in a string field like this example:
{
"version": "1.0"
}
will produce YAML output that changes the type of the string to a number. For example:
version: 1.0
This has caused various YAML deserializers I use to complain about unexpected types (especially when serializing into a strongly type structure that is expecting a string)
Steps To Reproduce
- Past the above example JSON into the
JSON <> YAML Converter
- Observe the YAML output contains a number instead of a string for the version field
- Converting the received YAML back to JSON therefore does not reproduce the original JSON
Expected behavior
When converting JSON strings that contain exclusively a string that can be interpreted as a number, it retains the type of the field when converting to YAML.
The expected output for the above YAML would be:
version: "1.0"
DevToys Version
Version 1.0.10.0 | X64 | RELEASE | b949a18 | b949a18