I have the following JSON:
{
"games": [
{
"id": 1,
"init_date": "2020-02-11T07:47:33.627+0000",
"players_in_game": [
{
"id": 1,
"player": {
"id": 1,
"player": "Jack Bauer",
"email": "[email protected]"
}
},
{
"id": 2,
"player": {
"id": 2,
"player": "Chloe O'Brian",
"email": "[email protected]"
}
}
]
},
{
"id": 2,
"init_date": "2020-02-11T08:47:33.627+0000",
"players_in_game": [
{
"id": 3,
"player": {
"id": 1,
"player": "Rome Jones",
"email": "[email protected]"
}
},
{
"id": 4,
"player": {
"id": 2,
"player": "Ludacris",
"email": "[email protected]"
}
}
]
},
]
}
And for every 'players-in game' I want to show one Player VS the other, let's say:
**PLayer 1 VS PLayer 2**
Jack Bauer Chloe O'Brian
Rome Jones Ludacris
But can't find the way of doing it properly. Here the code I put:
<tr v-for="(general, index) in getGamesAll.games" v-bind:key="index">
<td>Game {{general.id}}</td>
<td v-for="(gamePlayer, j) in general" :key="j">
{{general.players_in_game.player.player}}
</td>
<td>vs</td>
<td v-for="(gamePlayer, j) in general" :key="j">
{{general.players_in_game.player.player}}
</td>
</tr>
I already know this is wrong, because I'm looping over the same players-in_game reaching to player, but neither of both cases specify which player are inside the object I'm talking about.
How could this be accomplished?

v-foron the wrong object, looks like you should iterate overgeneral.players_id_game<td v-for="(gamePlayer, j) in general.players_in_game" :key="j">