How do I convert this Object

Asked

Viewed 36 times

-1

I would like to know how to convert the object:

[ { company: ["5dc317a826bc467c9ca8054e", "5e53f7d32b422507c4dcb11d" ] } ]

for ["5dc317a826bc467c9ca8054e", "5e53f7d32b422507c4dcb11d"] in Node.js.

  • 1

    Could you add more details to the question?

1 answer

2

It is not possible to "convert" this object the way you think, but it is possible to get the result you want by getting the attribute value company thus:

const objeto = [{company: ["5dc317a826bc467c9ca8054e", "5e53f7d32b422507c4dcb11d"]}];

const array = objeto[0].company;
console.log(array);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.