How to remove object key value of an object array?

I have an object array with object key value.

arr = [obj1:{name:"Jack", surname:"Peralto"}, obj2:{name:"Husnu", surname:"White"}]

I do not want to see obj1 and obj2 labels. Because of these labels I could not use a word template package.

So I want to convert it to this form.

arr = [{name:"Jack", surname:"Peralto"}, {name:"Husnu", surname:"White"}]

.map function does not work at first array.>o)

Why I have an array like this? I should use reduce function and obj1 and obj2 labels are key value when I create object array. Now I don’t need them.

>Solution :

When you fix the syntax errors in your code ([obj1:{... is not a valid data structure) you can use Object.values to get at the nested objects.

const obj = {
  obj1: {
    name: "Jack",
    surname: "Peralto"
  obj2: {
    name: "Husnu",
    surname: "White"


Leave a Reply