Need to display only array value in JSON output



PHP Snippet 1:

$rows = array();
foreach ($user_details as $row) {
  $rows[] = array_values((array)$row);
}

echo json_encode(array('aaData'=> $rows));

PHP Snippet 2:

{"aaData": [
    ["31","Elankeeran","[email protected]","0","1234"],
    ["33","Elan","[email protected]","1",""]
]}

PHP Snippet 3:

echo '{"aaData":'.json_encode(array_values($user_details)).'}';

PHP Snippet 4:

obj.aaData[0].name;
// Elankeeran

obj.aaData[0].email;
// [email protected]