Using PHP I am trying to add a float number 0.3 to a object then encode it but when I encode the object the float gets changed to a long decimal number.
<?php
   $test = 0.3;
   $data = new stdClass();
   $data->test = $test;
   echo json_encode ($data);
?>
 
    