i have a json with structure like this
{
"india": {
"north_states": ["TN", "AP", "MP", "AB"],
"south_states": ["PB", "UP", "RJ", "HR"]
},
"us": {
"north_states": ["AC", "AD", "AE", "AF"],
"south_states": ["BA", "BB", "BC", "BD"]
},
}
Now if I search for "UP", I have to get south_states
and india
as reply. how do i do that in JavaScript?
For example:
I need to get the country name based upon the input given in search. for example if i get the input value as 'UP' i need to search the json where UP is and get its key (south_states) and i also need to get the country name as india. the result should take the input of state acronym name and give both the keys as country name and the state_location(south or north)