What's structure

Hello. How can I get info (JS properties) from this JSON?

"anlamlarListe":[{"anlam_id":"4798","madde_id":"9592","anlam_sira":"1","fiil":"0","tipkes":"0","anlam":"Çocuğu olan kadın, ana, valide, kocakarı, mader, nene, aba","gos":"0","ozelliklerListe":[{"ozellik_id":"19","tur":"3","tam_adi":"isim","kisa_adi":"a.","ekno":"30"}]},{"anlam_id":"4799","madde_id":"9592","anlam_sira":"2","fiil":"0","tipkes":"0","anlam":"Yavrusu olan dişi hayvan","gos":"0"}]

You can inspect the structure of this data in your browser right now if you want. Open DevTools with F12 and load your data like so:

var data = {"anlamlarListe":[{"anlam_id":"4798","madde_id":"9592","anlam_sira":"1","fiil":"0","tipkes":"0","anlam":"Çocuğu olan kadın, ana, valide, kocakarı, mader, nene, aba","gos":"0","ozelliklerListe":[{"ozellik_id":"19","tur":"3","tam_adi":"isim","kisa_adi":"a.","ekno":"30"}]},{"anlam_id":"4799","madde_id":"9592","anlam_sira":"2","fiil":"0","tipkes":"0","anlam":"Yavrusu olan dişi hayvan","gos":"0"}]}

Now if you type data, it will show you the structure:

image

Get by anlam_id

var target = data.anlamlarListe.find(x => x.anlam_id == '4798')

Then you can get its properties like

target.madde_id
target.ozelliklerListe[0].tam_adi

I hope it helps :slight_smile:

2 Likes

Hello again. Thanks for help, but I don’t think it will work, because it’s official Turkish vocabulary API and anlam_id changes for every word (url is sozluk.gov.tr/gts?ara=word), so it isn’t permanent.

And thanks, I’ve solved the problem, now can get info from API. :slight_smile:

1 Like