In a given Json, search for the particular given string based on key, return true if found, else false Using jQuery/Javascript
- by NaanuManu
Given JSON String/object
{"selectAll":false,"include":{"country_197":{"id":"197","data_type":"country","name":"Singapore","desc":"","parent_key_id":"all_all","status":""},"country_100":{"id":"100","data_type":"country","name":"India","desc":"","parent_key_id":"all_all","status":""}},"exclude":{"state_2":{"id":"2","data_type":"state","name":"Andhra Pradesh","desc":"","parent_key_id":"country_100","status":""}}}
Given search string is: country_100
Required :
Have to search for country_100 in Given JSON String/object by key parent_key_id
Ex: searching country_100 is found :
{"selectAll":false,"include":{"country_197":{"id":"197","data_type":"country","name":"Singapore","desc":"","parent_key_id":"all_all","status":""},"country_100":{"id":"100","data_type":"country","name":"India","desc":"","parent_key_id":"all_all","status":""}},"exclude":{"state_2":{"id":"2","data_type":"state","name":"Andhra Pradesh","desc":"","parent_key_id":"**country_100**","status":""}}}
So return True, else return false
please help me in finding a solution.