I am facing difficulty finding the correct solution to my issue here. I am trying to iterate through the nested Products arrays in order to display each Product name. Can this be achieved with my current code, or should I consider rewriting it to make querying easier for me?
[
{
"category":"A",
"products":[
{
"id":1,
"name":"Product 1",
"description":"Description of product 1."
},
{
"id":2,
"name":"Product 2",
"description":"Description of product 2."
},
{
"id":3,
"name":"Product 3",
"description":"Description of product 3."
}
]
},
{
"category":"B",
"products":[
{
"id":4,
"name":"Product 4",
"description":"Description of product 4 in category B."
},
{
"id":5,
"name":"Product 5",
"description":"Description of product 5 in category B."
},
{
"id":6,
"name":"Product 6",
"description":"Description of product 6 in category B."
}
]
}
]