It would be great to have the JPath class and a slightly modified version of its Evaluate(JToken obj, JsonSelectSettings? settings) method publicly accessible to be able to use pre-parsed versions of JSON Paths in query intensive applications like in this mocked code that attempts to check if a JObject instance matches any of multiple rules in a large collection.
List<string> veryLargeCollectionOfJPathRules = [
"$..childN.propA",
"$..childN.childM.propA",
];
var compiledRules = veryLargeCollectionOfJPathRules.ConvertAll(path => new JPath(path)); // to have JPath exposed
var hasMatch = compiledRules.Any(rule => rule.Evaluate(objectUnderTest).Any()); // to have Evaluate() exposed
It would be great to have the
JPath
class and a slightly modified version of itsEvaluate(JToken obj, JsonSelectSettings? settings)
method publicly accessible to be able to use pre-parsed versions of JSON Paths in query intensive applications like in this mocked code that attempts to check if aJObject
instance matches any of multiple rules in a large collection.