How do I test if any of my json's properties has a particular subproperty,
without a loop?
Consider an example:
food : {
cheese: { taste: "delicious", smell: "smelly" },
bacon: { taste: "godly", smell: "godly" }
}
I would like a loop-less test to see if any of "food"'s properties (cheese
and/or bacon ) have a "taste" that is "godly".
In this case, it would be yes. Testing for "disgusting" should result in
false as there is none to have taste : "disgusting"
My question really revolves around a loopless solution, as a hundred
property json within several layers of loops is bad :(
No comments:
Post a Comment