I’m trying to create a code structure where people will list products based on the options they choose, but I got stuck at one point.
I’m pulling the data from the json file but I’m trying to provide the condition as follows. I want to extract the titles, prices and other information from the arrays with the same etiket values and print them to the document.
my Json data:
[
{
"id": 1,
"title": "Zincir Tasarımlı El Çantası",
"price": "49.90",
"upPrice": "69.90",
"currency": "₺",
"images": "./images/yeni.jpg",
"etiket": {
"cinsiyet": "kadin",
"yas": "yas16-20",
"konsept": "yilbasi"
}
},
{
"id": 2,
"title": "Tüylü Kısa Kol Çanta",
"price": "74.50",
"upPrice": "99.90",
"currency": "₺",
"images": "./images/yeni1.jpg",
"etiket": {
"cinsiyet": "kadin",
"yas": "yas20-30",
"konsept": "yilbasi"
}
},
{
"id": 3,
"title": "Zincir Detaylı Kemer Tokalı Çanta",
"price": "89.90",
"upPrice": "99.90",
"currency": "₺",
"images": "./images/yeni3.jpg",
"etiket": {
"cinsiyet": "erkek",
"yas": "yas16-20",
"konsept": "yilbasi"
}
},
{
"id": 4,
"title": "Zincirli Uzun Kol Deri Çanta",
"price": "69.90",
"upPrice": "89.90",
"currency": "₺",
"images": "./images/yeni4.jpg",
"etiket": {
"cinsiyet": "erkek",
"yas": "yas20-30",
"konsept": "yilbasi"
}
},
{
"id": 5,
"title": "Zincir Tasarımlı El Çantası",
"price": "49.90",
"upPrice": "69.90",
"currency": "₺",
"images": "./images/yeni5.jpg",
"etiket": {
"cinsiyet": "erkek",
"yas": "yas30-40",
"konsept": "yilbasi"
}
},
{
"id": 6,
"title": "Zincirli Deri Desenli Çanta",
"price": "109.90",
"upPrice": "129.90",
"currency": "₺",
"images": "./images/yeni6.jpg",
"etiket": {
"cinsiyet": "erkek",
"yas": "yas45ustu",
"konsept": "yilbasi"
}
},
{
"id": 7,
"title": "Kısa Kollu Deri Çanta",
"price": "199.90",
"upPrice": "269.90",
"currency": "₺",
"images": "./images/yeni7.jpg",
"etiket": {
"cinsiyet": "kadin",
"yas": "yas30-45",
"konsept": "yilbasi"
}
},
{
"id": 8,
"title": "Kahverengi Deri Desenli Kısa Kol Çanta",
"price": "349.90",
"upPrice": "369.90",
"currency": "₺",
"images": "./images/yeni8.jpg",
"etiket": {
"cinsiyet": "kadin",
"yas": "yas45ustu",
"konsept": "yilbasi"
}
}]
I’m giving an example. I want to draw the titles of the same “yilbasi” values, “yas16-20” values and “kadin” values to the page with innerHTML.
But I don’t know how to pull the data of the ones with the same values. I have not been able to create its structure. I want to do it with pure javascript if possible.