Is there a current way to represent strings as json int? #1503
Labels
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
The title may be pretty unspecific but what I am wanting is to give json the string value but without the quotes. (I am not saying for all string values, just ones I ask nlohmann::json to drop the quotes for)
Example: {"Voltage" : "15"} would instead be {"Voltage" : 15}
Now you may be questioning why not just use a int, etc. But the problem arises when I insert a double. I want to only display two numbers after the decimal spot. What my plan was;was insert the number into a string, cut the string after the two decimal spots and then ask nlohmann::json to represent that string as a number.
Here's an example of why I am asking to represent a string as number
What happens: {"Voltage" : 15.430000000001}
What I want: {"Voltage" : 15.43}
The text was updated successfully, but these errors were encountered: