I have a json doc that I am pulling from to populate a table as well as several other items on a sheet. At the same "level" of the document, I have objects and arrays. I am not sure how to manage displaying the children of the array and the children of the object in Vue.
I have tried using various if statements to show the children of the object and the children of the array separately, but have had no luck.
I can't show the actual code due to privacy but here is an overly simplistic example of the data I am looking at for this problem:
"Pairs": [
{
"Value": {
"Id": "123"
},
"Children": [
"Id": "111",
"String": {
"Value": "999",
"Children": [
{
"Key": "555"
},
{
"Key": "444"
},
]
}
]
},
{
"Value": {
"Id": "456"
},
"Children": [
"Id": "178",
"Strings": [
{
"Value": "845",
"Children": [
{
"Key": "079"
},
{
"Key": "106"
}
]
},
"Value": "578",
"Children": [
{
"Key": "279"
},
{
"Key": "745"
}
]
]
]
}
]
Then here is my table on the front end in Vue
<table>
<template v-for="Pair in Pairs">
<template v-for="Child in Pair.Children">
<template v-for="String in Child.Strings"> --- PROBLEM HERE
<tr v-for="Child in String.Children">
<td>{{Child.Key}}</td>
</tr>
</template>
</template>
</template>
</table>
As you can see from the above example, the first of the objects in the Pairs array has an object called "String" and the second has an array called "Strings". As you may expect, I get an undefined error when I try to access either the object String or the array Strings in my Vue document. I am pretty stuck.