Add Exists function

This commit is contained in:
Svilen Markov 2025-02-09 05:32:30 +00:00
parent 5a06f4788b
commit 8331c4b305

View file

@ -133,6 +133,10 @@ func gJsonResultArrayToDecoratedResultArray(results []gjson.Result) []decoratedG
return decoratedResults
}
func (r *decoratedGJSONResult) Exists(key string) bool {
return r.Get(key).Exists()
}
func (r *decoratedGJSONResult) Array(key string) []decoratedGJSONResult {
if key == "" {
return gJsonResultArrayToDecoratedResultArray(r.Result.Array())