Question: I have an array of objects in the following form

```
var data = [{"name":"Lenovo Thinkpad 41A4298","website":"google"},
{"name":"Lenovo Thinkpad 41A2222","website":"google"},
{"name":"Lenovo Thinkpad 41Awww33","website":"yahoo"}];

```

I want to convert this to

```
var data = [{"Brand":"Lenovo Thinkpad 41A4298","Link":"google"},
{"Brand":"Lenovo Thinkpad 41A2222","Link":"google"},
{"Brand":"Lenovo Thinkpad 41Awww33","Link":"yahoo"}];

```

How do I achieve this?

Answer: 
Using foreach loop

```js
var data = [{
    "name": "Lenovo Thinkpad 41A4298",
    "website": "google"
  },
  {
    "name": "Lenovo Thinkpad 41A2222",
    "website": "google"
  },
  {
    "name": "Lenovo Thinkpad 41Awww33",
    "website": "yahoo"
  }
];

var Result = [];

var Key = Object.keys(data[0]); // get keys in a variable

// use index insted of specific key

data.forEach(function(item) {
  Result.push({    Brand: item[Key[0]],    Link: item[Key[1]]  });
});

console.log(Result);
```
You can use `map` to loop thru the array. Without using the key, you can use `Object.values` to convert the object into an array. Assign the first element of the array on Brand and the second to Link to form a new object.

```js
var data = [{
    "name": "Lenovo Thinkpad 41A4298",
    "website": "google"
  },
  {
    "name": "Lenovo Thinkpad 41A2222",
    "website": "google"
  },
  {
    "name": "Lenovo Thinkpad 41Awww33",
    "website": "yahoo"
  }
];

var result = data.map(o => {
  let v = Object.values(o);
  return {"Brand": v[0],"Link": v[1]};
});

console.log(result);
```