How select and use just the first flavor from this json:
[
{
"id": 1,
"name": "Gelato",
"image": "galato-icon",
"available": {
"id": 1,
"flavor":
{
"choice1": "Dark Chocolate",
"choice2": "Pistachio",
"choice3": "Raspberries",
"choice4": "Lemon",
"choice5": "Tiramisu"
},
"images": [
"chocolate gelato",
"pistachio gelato",
"raspberry gelato",
"lemon gelato",
"tiramisu gelato"
],
"price": 5.49,
"description": "Italian Ice Cream, that's made with whole milk, rather than cream. This difference enhances the flavors and puts a smile on your face."
}
},
{
"id": 2,
"name": "Rolled",
"image": "rolled-icon",
"available": {
"id": 2,
"flavor":
{
"choice1": "Paan King",
"choice2": "Strawberry Banana",
"choice3": "Mint Chocolate Chip",
"choice4": "Brownie",
"choice5": "Salty, Sweet Caramel"
},
"images": [
"paan rolled",
"strawberry rolled",
"mint rolled",
"brownie rolled",
"caramel rolled"
],
"price": 8.99,
"description": "Italian Ice Cream, that's made with whole milk, rather than cream. This difference enhances the flavors and puts a smile on your face."
}
},
{
"id": 3,
"name": "Ice Popsicle",
"image": "popsicle-icon",
"available": {
"id": 3,
"flavor":
{
"choice1": "Banana",
"choice2": "Cherry",
"choice3": "FireCracker",
"choice4": "Fudge",
"choice5": "Grape"
},
"images": [
"banana popsicle",
"cherry popsicle",
"firecracker popsicle",
"fudge popsicle",
"grape popsicle"
],
"price": 2.48,
"description": "Italian Ice Cream, that's made with whole milk, rather than cream. This difference enhances the flavors and puts a smile on your face."
}
},
{
"id": 4,
"name": "Soft Servce",
"image": "soft-icon",
"available": {
"id": 4,
"flavor":
{
"choice1": "Chocolate",
"choice2": "Vanilla",
"choice3": "Strawberry",
"choice4": "Cookies and Cream",
"choice5": "Mint Chocolate Chip"
},
"images": [
"chocolate soft",
"vanilla soft",
"strawberry soft",
"cookies soft",
"mint soft"
],
"price": 3.39,
"description": "Italian Ice Crea, that's made with whole milk, rather than cream. This difference enhances the flavors and puts a smile on your face."
}
},
{
"id": 5,
"name": "Frozen Yogurt",
"image": "yogurt-icon",
"available": {
"id": 5,
"flavor":
{
"choice1": "Vanilla",
"choice2": "Chocolate",
"choice3": "Strawberry",
"choice4": "Cookies and Cream",
"choice5": "Banana"
},
"images": [
"vanilla yogurt",
"chocolate yogurt",
"strawberry yogurt",
"cookies yogurt",
"banana yogurt"
],
"price": 5.69,
"description": "Italian Ice Crea, that's made with whole milk, rather than cream. This difference enhances the flavors and puts a smile on your face."
}
},
{
"id": 6,
"name": "Mochi",
"image": "mochi",
"available": {
"id": 6,
"flavor":
{
"choice1": "Red Bean",
"choice2": "Chocolate and Vanilla",
"choice3": "Strawberry",
"choice4": "Tiramisu",
"choice5": "Green Tea"
},
"images": [
"red bean mochi",
"chocolate mochi",
"strawberry mochi",
"tiramisu mochi",
"greentea mochi"
],
"price": 4.97,
"description": "Bite into the center of Mmmm. Made with real fruit, and bursting with sweet bits."
}
}
]
So that I can fill in list of views with the data?
This is what I’ve tried:
ForEach(model.icecreams) { item in
Text(item.available.flavor.choice1)
}
If I try to use a index “[0]” it wont work.