You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not strictly a bug, but not ideal. Many apps print a simple '0' for all zero numbers, regardless of type. nlohmann-json parses those as unsigned int and throws an exception, for example in value(var, 0.0). There should be an option to promote 0 to float in this case; perhaps even for other numbers that look like an int. Or maybe there is such an option and I don't know it?
Reproduction steps
parse a Json file (not written by nlohmann, of course) that contains simple integer strings as values that you know should be float, using value(var, 0.0).
Expected vs. actual results
expect automatic promotion to double or whatever I assign the value to
get an exception complaining of incompatible types
Minimal code example
No response
Error messages
No response
Compiler and operating system
MSVCC 2022 Win10
Library version
3.9.1
Validation
The bug also occurs if the latest version from the develop branch is used.
Description
Not strictly a bug, but not ideal. Many apps print a simple '0' for all zero numbers, regardless of type. nlohmann-json parses those as unsigned int and throws an exception, for example in value(var, 0.0). There should be an option to promote 0 to float in this case; perhaps even for other numbers that look like an int. Or maybe there is such an option and I don't know it?
Reproduction steps
parse a Json file (not written by nlohmann, of course) that contains simple integer strings as values that you know should be float, using value(var, 0.0).
Expected vs. actual results
expect automatic promotion to double or whatever I assign the value to
get an exception complaining of incompatible types
Minimal code example
No response
Error messages
No response
Compiler and operating system
MSVCC 2022 Win10
Library version
3.9.1
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: