Convert json to array using pure javascript

Asked

Viewed 644 times

0

I have an object

{
         '1': {
          'nome': 'pedro',
          'idade': 2,
        },
        '2': {
          'maria': maria,
          'idade': 5,

        }
}

Array

[{
        '1': {
          'nome': 'pedro',
          'idade': 2,

        },
        '2': {
          'maria': maria,
          'idade': 5,

        }
}]

I need to check if it is an object like the example and if it will transform into an array as per

pure javascript template

  • This question already has an answer here: https://answall.com/questions/105978/converter-array-de-objetos-para-um-array-de-arrays

  • @Leandro Good night! It’s not the same thing I want to convert to an array of objects

1 answer

0


  • Perfect!! Solved here!!!

Browser other questions tagged

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