I have to write json result in a string.
Here is my code,
<!DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="POST">
Enter Pin <input type="text" name="pinCode">
<input type="submit" name="formSubmit">
</form>
</body> </html>
<?php
if(isset($_POST['formSubmit']))
{
$input = $_POST['pinCode'];
$shortUrl=file_get_contents("https://www.whizapi.com/api/v2/util/uiin/indian-city-by-postal-code?project-app-key=<app_key>&pin=".$input);
$res = json_decode($shortUrl, true);
echo implode($res);
}
?>
Currently the outcome is on json format. I have to print the result in string. e.g - { "title" : "Mr", "name" : "sandeep"}. Result would be like "Mr sandeep". That's why I have used json_decode for changing json into array but then I couldn't understand how to change associative array in string.
Thanks in advance.