"data": {
"master": {
"chicken": [
{
"productId": 6,
"productName": "Test prod",
"productIsSpecial": 1,
"restaurantId": 1,
"categoryId": 3,
"categoryName": "chicken",
"productImage": "2021-08-18T21:16:11.197586800_category.jpg",
"productRating": 5.0,
"productPrice": 10.0,
"productEnabled": 1
},
],
"wheat beer": [
{
"productId": 1,
"productName": "Non-Veg pizza",
"productIsSpecial": 1,
"restaurantId": 1,
"categoryId": 1,
"categoryName": "wheat beer",
"productImage": "2021-08-22T17:24:02.969600500_category.jpg",
"productRating": 5.0,
"productPrice": 200.0,
"productEnabled": 1
},
]
},
I encountered this JSON response and I aim to exhibit all the products with their respective category array in my project using vue3 as my front-end js framework. My initial attempt with result.data.data.master
only unveiled data inside the category array without indicating the actual array name.
My goal is to showcase the category name along with the product list. How can I achieve displaying "chicken" as a cat name above the product list?
Edit: To clarify, I want to present a list of products categorized under each specific category. Currently, the category in question is chicken[]
and I am successfully retrieving that category's product list:
"chicken": [
{
"productId": 6,
"productName": "Test prod",
"productIsSpecial": 1,
"restaurantId": 1,
"categoryId": 3,
"categoryName": "chicken",
},
],
Given this scenario, how can I specifically display chicken
as a category name prior to listing the products within it?