if($stmt->execute()){
$user = $stmt->get_result();
while ($obj = $user->fetch_object()) {
$result[] = $obj;
}
}
$result1encoded = json_encode($result);
echo $result1encoded;
// [{"uId":"1","firstName":"John"}]
I used implode like this :
echo $result1encoded = implode(' ',$result1);
// expecting '[{"uId":"1","firstName":"John"}]'
But it says
Object of class stdClass could not be converted to string