Get item corresponding to another item from json in php
717
I want to read this JSON using PHP:
{
["person":{
{"name":"Bill"},
{"age":"56"},
{"city":"Houston"}
}],
["person":{
{"name":"Jack"},
{"age":"45"},
{"city":"Dallas"}
}],
["person":{
{"name":"Henry"},
{"age":"33"},
{"city":"Atlanta"}
}]
}
Now I want to look for the person who's name is Jack and get the city he lives in. I know how to check for the name. But how can I get the corresponding city then?
Answer
Solution:
I think this should make it: