I Have a JSON input format, here's an exemple :

{
  "friends": [
    {
      "id": "5a8d4euyiuyiuyhiuyc022c7158d5",
      "name": "Gloria Coffey"
    },
    {
      "id": "5a8d4e2rytuyiyuyiytiy3e426",
      "name": "Shawn Ellison"
    }
  ]
}

I would transform it to an array key: value arrays, something like this :

[[id : "5a8d4euyiuyiuyhiuyc022c7158d5", name:"Gloria Coffey"],[id : "5a8d4e2rytuyiyuyiytiy3e426", name:"Shawn Ellison"]]

What I have done :

search(event) {
    this.searchRmpmService.getResults(event.query).then(data => {
    this.results = data.friends;
    console.log(this.results);
    let output = [];
    output= Object.entries(this.results);
    console.log(output);
});

the first console.log of this.results prints me an array of objects

then my output array prints:

0:Array(2)
0:"0" <-- ??
1:{
   id:"5a8d4e2ffead0c022c7158d5",
   name:"Gloria Coffey"
}length:2__proto__:Array(0)

what I would is

id : 5a8d4e2ffead0c022c7158d5
name : Gloria Coffey

You could also do it by using Object.fromEntries() like this:

function flattenArrayToObject(arr) {
  let entries = arr.map(el => [el.id, el.name])
  let obj = Object.fromEntries(entries)
  return obj;
}

Or in a one liner if you really needed to:

let flattenArray = arr => Object.fromEntries(arr.map(el => [el.id, el.name]))

Demo in Stack Snippets

<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js -->
let friends = [
    {id: "158d5", name: "Gloria"},
    {id: "3e426", name: "Shawn"}
]

function flattenArrayToObject(arr) {
  let entries = arr.map(el => [el.id, el.name]) // [["158d5","Gloria"], ["3e426","Shawn"]]
  let obj = Object.fromEntries(entries)
  return obj;
}

console.log(flattenArrayToObject(friends))
<!-- end snippet -->