当我执行while循环以获取数组中的结果时,json_encode()错误输出

from this php while loop i fetch the results in a array

$rows = array();
$result = mysqli_query($con,"call getProductVariationByID($name)");
//$row = mysqli_fetch_array($result);
 while ($row = mysqli_fetch_assoc($result))
   {
    $rows['Product'][] = $row;
   }
  echo json_encode($rows, JSON_PRETTY_PRINT);

the result is with this 'null' in the end :

        "post_mime_type": "",
        "comment_count": "0"
    }
  ]
}null

I bet the function containing this code is echo'd in your main php script.