Skip to content

How to make an array of objects from object array in vueJs?

I have an Object array which is following enter image description here

But, I need to show

  • email: Email muss eine …..
  • phone: Telefonnummer ist …

How can I do this in javascript? Actually I need to use this in VueJs.


From the screenshot you are receiving this from props so we can do this in the template:

  <div class="errors">
    {{ ?[0] }}

If you would like to get all the errors into a single array (e.g. ['Email mus...', 'Telefon ...']) you can do:

   <li v-for="error in Object.keys(failureReasons).map(key => failureReasons[key][0])"> {{ error}} </li>