$a = array('val'=>intval(1.0));//结果{"val":1} $b = array('val'=>number_format(floatval(1.0),1));//结果{"val":1.0} echo json_encode($a); echo json_encode($b);