This has been causing me some issues solving:
If I have JSON object coming from a REST endpoint such as this;
SomeArray =
[{"id":"1","genre":"Folk"},
{"id":"2","genre":"punk"},
{"id":"13","genre":"Punk (original)"},
{"id":"14","genre":"Punk (revival)"},
{"id":"25","genre":"Hard Rock"},
{"id":"66","genre":"Heavy Metal"} ..... ]
and I know that I want to access the item with an id of 25 for example, and get the value of genre
This for example:
var myID = 25
var my value = SomeArray[myID].genre
looks to the 25th element of the JSON object SomeArray. How can I properly access the sibling of the element with the id = 25 for example and return the genre value?
I tried
SomeArray.id[myID].genre but not correct syntax of course.
Thanks for any help
This is in an angular controller if there is anything in angular that might assist also you might be aware of.