If you do this ...
var parsed = JSON.parse('{"myNum":0.0}') ;
Then when you look at parsed.myNum you just get 0 . (Fair enough.)
If you do parsed.myNum.toString() , you get "0" .
Basically, I'm looking for a way to turn this into the string "0.0" .
Obviously, in real life, I do not control JSON input, I get JSON from a web service ... I want to parse JSON using a browser JSON analyzer and be able to recognize the difference between the numerical values 0 and 0.0 .
Is there a way to do this, apart from manually reading a JSON string? In this case, this is not real, I need to use my own JSON analyzer for speed. (By the way, for the Chrome extension, you donβt have to worry about it while working in other browsers.)
source share