Below code is the returned JSON
[{"one":"id","two":"id","three":"id"},{"one":"id","two":"id","three":"id"}]
Below code is the desired result of the returned JSON (without the array bracket)
{"one":"id","two":"id","three":"id"},{"one":"id","two":"id","three":"id"}
Below code is to convert the array to the JSON format
include('connect-db.php');
$result = mysql_query("SELECT * FROM patientvaccinedetail");
$specific = [];
while($row = mysql_fetch_array( $result ,MYSQL_ASSOC)) {
echo "<tr>";
echo '<td width="100px">' . $row['id'] . '</td>';
echo '<td width="200px">' . $row['patientid'] . '</td>';
echo '<td width="200px">' . $row['vaccineid'] . '</td>';
//**********Convert the array into json*******************
$specific[] = ["one" => $row["id"],
"two" => $row["patientid"],
"three" => $row["vaccineid"]];
$result = json_encode($specific,JSON_UNESCAPED_UNICODE);
echo $result;
echo "</tr>";
echo "</table>";
?>
To send the request to the API, iam using Guzzle And the format the API require is {xx:xx},{xx:xx} without the square bracket, any idea how to remove it using PHP. Thanks in advance
$client = new Client([
'headers' => ['Content-Type' => 'application/json',
'Token' => $token]
]);
$response = $client->post('http://localhost:91/Religious',
['body' => ***Where the json will be place***]
);