How to convert object's attributes in kebab-case to camelCase

40 Views Asked by At

I'm receiving a json formatted in kebab-case, like so :

{name: "田中 太郎", profile-image: "", visit-frequency: "10"}

I have multiple objects that I want to display in my template, so I'm using a v-for. But I can't figure out how to display profile-image or visit-frequency, as I obviously can not do :

<li class="cell" v-for="item in members">
  <img :src="item.attributes.profile-image" :alt="item.attributes.name">
</li>

I'm thinking about a loop on my list of objects and rename those attributes, but I feel like there something better than that.

0

There are 0 best solutions below