I have used data_str = JSON.stringify(data); to convert into string. the data in json is
[{"temperSensorData":"28.489084691371996","temperSensorUnit":"celsius","timestamp":"1493270171424","timestamp2":"1493270171454","timestamp3":"1493270171454","val":"0"},{"temperSensorData":"28.48908469137112","temperSensorUnit":"celsius","timestamp":"1493270171426","timestamp2":"1493270171522","timestamp3":"1493270171523","val":"1"},{"temperSensorData":"28.489084691371186","temperSensorUnit":"celsius","timestamp":"1493270171426","timestamp2":"1493270171523","timestamp3":"1493270171524","val":"2"},{"temperSensorData":"28.489084691371595","temperSensorUnit":"celsius","timestamp":"1493270171426","timestamp2":"1493270171524","timestamp3":"1493270171525","val":"3"},{"temperSensorData":"28.48908469137168","temperSensorUnit":"celsius","timestamp":"1493270171428","timestamp2":"1493270171529","timestamp3":"1493270171529","val":"4"},{"temperSensorData":"28.489084691371684","temperSensorUnit":"celsius","timestamp":"1493270171428","timestamp2":"1493270171529","timestamp3":"1493270171529","val":"5"},{"temperSensorData":"28.489084691371357","temperSensorUnit":"celsius","timestamp":"1493270171429","timestamp2":"1493270171530","timestamp3":"1493270171531","val":"6"},{"temperSensorData":"28.489084691371144","temperSensorUnit":"celsius","timestamp":"1493270171429","timestamp2":"1493270171531","timestamp3":"1493270171532","val":"7"},{"temperSensorData":"28.48908469137181","temperSensorUnit":"celsius","timestamp":"1493270171431","timestamp2":"1493270171546","timestamp3":"1493270171546","val":"25"}]
Now I want to take timestamp value and perform some mathematical operations.How to convert this into Float values? Even Though I used parseInt(timestamp) and Number(timestamp), it is not working and showing me result: NaN.
parseInt(data[0]["timestamp"]is just giving you a number, which is also a floating-point value.parseFloat(data.timestamp)