Skip to content

Commit 7332dc8

Browse files
committed
Fix for nested array selection
1 parent cf745f9 commit 7332dc8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/json_path/walker.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
(defn map# [func obj]
1818
(if (seq? obj)
19-
(map func obj)
19+
(map (partial map# func) obj)
2020
(func obj)))
2121

2222
(defn- select-all [current-context]

test/json_path/test/json_path_test.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
{:bar "baz" :hello "world"}]}) => ["world"]
2525
(at-path "$.foo[?(@.id=$.id)].text"
2626
{:id 45, :foo [{:id 12, :text "bar"},
27-
{:id 45, :text "hello"}]}) => ["hello"])
27+
{:id 45, :text "hello"}]}) => ["hello"]
28+
(at-path "$.foo[*].bar[*].baz"
29+
{:foo [{:bar [{:baz "hello"}]}]}) => [["hello"]])
2830

2931
(facts
3032
(-> (query "$.hello"

0 commit comments

Comments
 (0)