I'm trying to use JSON.stringify() to parse some values into JSON format. That amount is a string variable.I want the final value in JSON format as a number, but my current way doesn't work. It still comes out as "price":"1.00" after JSON.stringify() . How do I make sure the final value in JSON is a number? Thanks for your help!
My current code:
var data = JSON.stringify({
"payer": "a cat",
"price": parseFloat(amount).toFixed(2),
});