How to get those data using with ajax json?

There are two methods to access the object.

1. Ajax response.

$.ajax({
  url:"your_file.php",
  type : "POST",
  data : your_data,
  dataType: "json",
  success:function(data){  
    // Retrieve the object
    var result = data[0];
    // Grab username from the object
    console.log(result['username']);
  },
  error:function(xhr){
    alert('Ajax request fail');
  }
});

2. Server side script

$yourArray = array();
$yourJson = json_encode($yourArray);
$userData  = $yourJson->searchUser($yourJson);
$jsonData = json_decode($userData);
// Ouput the inner contents
echo json_encode($jsonData[0]);