In your http://localhost/staff/home.php in your else part:
else{
$all_users = $obj->getAllUsers();
$r = json_encode($all_users);
echo $r;
}
Updated my code as per your JSON:
put below JSON on "http://localhost/staff/home.php" as it is (actually this is your JSON output you are getting from your code)
[{
"id": "94",
"username": "jems",
"password": "123",
"email": "jems@gmail.com",
"mobile": "8596558499",
"address": "Banglor",
"gender": "male",
"salary": "0",
"status": "1",
"image_name": "1320294973-screenshot.jpg"
}, {
"id": "99",
"username": ".sapna",
"password": "sapna9",
"email": "sapnapapola15@gmail.com",
"mobile": "8826089668",
"address": "laxminagar",
"gender": "male",
"salary": "0",
"status": "1",
"image_name": "no-image.jpg"
}]
And below is the code your "http://localhost/staff_json/index.php"
<?php
$rs = file_get_contents("http://localhost/staff/home.php");
$obj = json_decode($rs);
echo "<pre>";
print_r($obj);
?>
I am getting the desired output

]3

AS per your code:
Prepare a separate file "userdata.php" place it to same folder where the "home.php" page /staff/userdata.php
<?php
include('config/controller.php');
$obj = new Controller();
$all_users = $obj->getAllUsers();
$r = json_encode($all_users);
echo $r;
?>
And below is the code your "http://localhost/staff_json/index.php"
<?php
$rs = file_get_contents("http://localhost/staff/userdata.php");
$obj = json_decode($rs);
echo "<pre>";
print_r($obj);
?>
Then you get the desired output:
Below is your "home.php" page PHP script:
<?php
include('config/controller.php');
$obj = new Controller();
include('header.php');
$obj->authenticate();
$all_users = '';
$search_field ='';
$btn_search = isset($_GET['btn_search'])?$_GET['btn_search']:'';
if($btn_search =='Serach' && $btn_search !='') {
$search_field = isset($_GET['search_field'])?$_GET['search_field']:'';
$all_users = $obj->getAllUsers($search_field);
}
?>
I removed your else part
Try this hope it will work for you