BarryDale2014 BarryDale2014 - 5 months ago 21
Javascript Question

How to maintain data integrity using JSON.parse()

I am trying to parse data using

JSON.parse(response)
but the function is removing the trailing zeros because my data is coming through as numbers and not as
Strings
. I don't have any control over the data coming in and I need a way to keep the zeros.

Something like:

{"name":"apples","price":15.40 }


returns
15.4
. Is there a way to do this using
JSON.parse()
?

Answer
Comments