diff --git a/src/json_path/walker.clj b/src/json_path/walker.clj index 121f7de..66c29d1 100644 --- a/src/json_path/walker.clj +++ b/src/json_path/walker.clj @@ -24,7 +24,7 @@ (defn obj-vals [obj] (cond (seq? obj) obj - (map? obj) (filter map? (vals obj)) + (map? obj) (filter #(or (map? %) (sequential? %)) (vals obj)) :else [])) (defn obj-aggregator [obj] diff --git a/test/json_path/test/walker_test.clj b/test/json_path/test/walker_test.clj index 93c5f80..4264aff 100644 --- a/test/json_path/test/walker_test.clj +++ b/test/json_path/test/walker_test.clj @@ -27,7 +27,10 @@ (walk-path [[:root]] {:root ...root..., :current ...obj...}) => ...root... (walk-path [[:root] [:child] [:key "foo"]] {:root {:foo "bar"}}) => "bar" (walk-path [[:all-children]] {:current {:foo "bar" :baz {:qux "zoo"}}}) => [{:foo "bar" :baz {:qux "zoo"}}, - {:qux "zoo"}]) + {:qux "zoo"}] + (walk-path [[:all-children] [:key "bar"]] + {:current {:foo [{:bar "wrong"} + {:bar "baz"}]}}) => ["wrong" "baz"]) (fact (walk-selector [:index "1"] {:current ["foo", "bar", "baz"]}) => "bar"