So, I have a json object that has this structure:
{ "John Doe": [ { "childName": "Harry", "childAge": 15, "childGender": "Male" }, { "childName": "Sally", "childAge": 9, "childGender": "Female" }, ], "Miss Piggy": [ { "childName": "Jane", "childAge": 20, "childGender": "Female" } ],
}
What I want to do is make a request for childName, childAge or childGender and return this sub-object if it is found.
For example:
searchJson($jsonObj, 'childName', 'Sally') // returns {"childName":"Sally", "childAge":9,"childGender":"Female"}
What would be the best method for doing this?
Baehr
source share