I have a json file similar to the following structure.
{
"anakategori": [
{
"name": "Kadın",
"url": "example.com/kadin",
"img": "..."
},
{
"name": "Erkek",
"url": "example.com/erkek",
"img": "..."
},
{
"name": "Ayakkabı &Çanta",
"url": "example.com/ayakkabi-canta",
"img": "..."
},
{
"name": "Anne &Bebek",
"url": "example.com/anne-bebek",
"img": "..."
},
{
"name": "Elektronik",
"url": "example.com/elektronik",
"img": "..."
},
{
"name": "Ev &Yaşam",
"url": "example.com/ev-yasam",
"img": "..."
},
{
"name": "Kozmetik",
"url": "example.com/kozmetik-kisisel-bakim",
"img": "..."
},
{
"name": "Saat &Aksesuar",
"url": "example.com/saat-aksesuar",
"img": "..."
},
{
"name": "Kitap,Müzik,Film,Oyun",
"url": "example.com/kitap-muzik-film-oyun",
"img": "..."
},
{
"name": "Bahçe,Yapı Market,Oto",
"url": "example.com/bahce-yapi-market,-oto",
"img": "..."
},
{
"name": "Çok Satan Ürünler",
"url": "example.com/cok-satan-urunler",
"img": "..."
},
{
"name": "İndirimli Ürünler",
"url": "example.com/indirimli-urunler",
"img": "..."
},
{
"name": "En Çok Görüntülenenler",
"url": "example.com/en-cok-goruntulenenler",
"img": "..."
},
{
"name": "Markalar",
"url": "example.com/markalar",
"img": "..."
}
]
}
In this file, I want to automatically fill the "img": "..." field with the url sorted in the order of the above.
The urls in the file are like this:
example.com/category/kadin.png
example.com/category/erkek.png
example.com/category/ayakkabicanta.png
Thanks in advance for your help.
I got the urls in order with regex from the json file and I got the img urls from the metadata, now how can I add them to this file in order?