将PHP数组值和键传递给Javascript版本

I already checked the questions that are similar to mine but I can't seem to find what I'm looking for.

My goal is to use the data for my autocomplete function in one of my search bars.

So I have a PHP array from a mysqli query:

Array ( 
[65a7de8825d0be1a8db3b53d2893a7b0] => Isagani Colorado 
[60f97bb49fa9b035dd4007230a43475e] => Mercedita Labacco 
[77774b62b3e0f465a395491936410bf9] => Simundo Dalisay 
[98bf4551b15e3b0d12adcd2131d10dc8] => Ma.Violeta Buhay 
[341a0067a0a66702eaa96b548e9ac23d] => Roman Bantigue 
[2c493705fc971c5667d0e81d85e6d439] => Mavita Gonzales 
[5b233111cbc932b84fb86859ebb1bd6d] => Romeo Galang 
[2eb29f296d567470c1e9a6c376d33296] => Jerome Calayag 
[4a7177533b06cbd0f8b222969a770cff] => Racquel Pajares 
[333270ceb56e62de9dc1b2591ed5e686] => Rogelio Gamba 
[206b7ce18360b7a3c88d6caa6401292a] => Amelia Enriquez 
[53c2db056f0f51d975562f8276fecf85] => Rufino DeVega )

And I have passed my array in Javascript using <?php echo json_encode($data); ?>:

{
"65a7de8825d0be1a8db3b53d2893a7b0":"Isagani Colorado",
"60f97bb49fa9b035dd4007230a43475e":"Mercedita Labacco",
"77774b62b3e0f465a395491936410bf9":"Simundo Dalisay",
"98bf4551b15e3b0d12adcd2131d10dc8":"Ma.Violeta Buhay",
"341a0067a0a66702eaa96b548e9ac23d":"Roman Bantigue",
"2c493705fc971c5667d0e81d85e6d439":"Mavita Gonzales",
"5b233111cbc932b84fb86859ebb1bd6d":"Romeo Galang",
"2eb29f296d567470c1e9a6c376d33296":"Jerome Calayag",
"4a7177533b06cbd0f8b222969a770cff":"Racquel Pajares",
"333270ceb56e62de9dc1b2591ed5e686":"Rogelio Gamba",
"206b7ce18360b7a3c88d6caa6401292a":"Amelia Enriquez",
"53c2db056f0f51d975562f8276fecf85":"Rufino DeVega"
}

I can get either of them using <?php echo '["' . implode('", "', $data) . '"]'; ?>; if I want to get the values and <?php echo '["' . implode('", "', array_keys($data)) . '"]'; ?>; if I want to get the keys.

My [noob] question is, how can I format my data so I can get the key value when the user selects the name(value) in the input box?

enter image description here

EDIT:

I need the key to be passed on my Javascript function:

function SearchGrave(){
    var uuid = $('#name').val();
    $("#grave-content").load("fetch_grave.php?uuid="+encodeURIComponent(uuid));
}

Any help is highly appreciated.

Thank you very much,

Eli

After a few experimentations, here's what I got.

I changed my array syntax to this inside my while loop:

$data[] = array('uuid' => $grave_query_r['uuid'], 'full_name' => $grave_query_r['firstname'].' '.$grave_query_r['lastname']);

And called it inside my Javascript:

var choices = <?php 
    echo '['.implode(', ', array_map(function ($entry) {
                      return '["'.$entry['uuid'].'","'.$entry['full_name'].'"]';
                    }, $data)).']';.
?>

Thanks everyone!