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