I have to store floating point numbers in JSON in scientific notation (just like the OP does in this question).
The values I have to write into JSON are <number>
s in my JavaScript (Angular/TypeScript) application, and I'm converting them into scientific form like (42).toExponential()
.
The problem is that toExponential() returns a string value, so later in my JSON notation 42
will become "4.2e+1"
and not 4.2e+1
.
How could I get rid of the quotation marks?