I looked for an good answer but found none.
An API returns JSON like this [{id:31, name:"blue"},{id:22, name:"green"},..]
I would like to like to get the name from id $api->[where id= 2]
The only way I found was to convert this array to obj and having the id as key. Is there no better PHP way?