[Vuejs]-How can I access nested data via an array with parsed json

0👍

This seems unnecessarily complicated.

Consider using computed, like this

...
  computed: {
    mappedData() {
      return this.service.map(item => {
        Description: item.Description,
        Location: item.organization.locations[1].streetAddress,
        EIN: item.organization.EIN
      })
    }
  }
...

You can then access the data in the template with:

...
<element v-for="item in mappedData">
  {{item.Description}}
  {{item.Location}}
  {{item.EIN}}
</element>
...

Leave a comment