Thanks Peter, I read the articles, they are helpful and everything works. I just wanted you to have a look at the PHP.
After several attempts, I found array_push() will populate the array for JSON, and Firefox displays it as expected. Now I can download the value to JavaFX
<?php
header("Content-type:application/json; charset=UTF-8");
$conn = mysqli_connect("localhost", "usr", "pwd", "instance");
mysqli_set_charset( $conn, "utf8mb4" );
if (mysqli_connect_errno($conn)) {
echo "Failed to connect to MySQL: " .mysqli_connect_error();
}
$coyId = $_REQUEST['personId'];
$cAddrL1 = $_REQUEST['pAddrL1'];
$result = $conn->multi_query("CALL sp_updCompany('$personId','$pAddrL1', @flag); SELECT @flag");
$response = array();
if($result) {
/** this works **/
array_push(($response), array('flag'=>$result));
echo json_encode($response);
} else {
array_push(($response), array('flag'=>-1));
echo json_encode ($response);
}
mysqli_close($conn);
?>