从php调用数组

If i want to call an array from php into typescript also in an array form how i can do it this is my php code :

$AccessQuery = "SELECT name,lastname,phone,email
                      FROM user
                     INNER JOIN access ON id

                     WHERE id 
$userQuery = mysqli_query($localhost, $AccessQuery) or trigger_error(mysql_error(), E_USER_ERROR);
while ($AccessQueryRow = mysqli_fetch_assoc($userQuery)) {
    $AccessData[] = array(
        'id' => $AccessQueryRow['id'],
        'code' => $AccessQueryRow['code'],

    );
};

$arr = array(

    "user_access_details" => $AccessData,

);
echo json_encode($arr);

I try this in order to encoded and use each one as a variable in an array

 var jsonData = JSON.parse(data);

what i really want is how i can put each menu_id in an array field : arr= {id1,id2} the same for the code

how i can put each menu_id in an array field : arr= {id1,id2}

If you only care about the ids, ignore the code values. Get the array of the shape you want in PHP.

while ($AccessQueryRow = mysqli_fetch_assoc($userQuery)) {
    $AccessData[] = $AccessQueryRow['id'];
};

echo json_encode($AccessData);

On the client side:

var jsonData = JSON.parse(data);

The result will be the array of just ids.