freestrings / jsonpath

JsonPath engine written in Rust. Webassembly and Javascript support too

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bracket notation after recursive descent does not recurse

cburgmer opened this issue · comments

Selector: $..[0]

Input:

["first", {"key": ["first nested", {"more": [{"nested": ["deepest", "second"]}, ["more", "values"]]}]}]

Expected output:

["deepest", "first nested", "first", "more", {"nested": ["deepest", "second"]}]

Actual output:

["first"]

Compare https://cburgmer.github.io/json-path-comparison/. For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Rust_jsonpath_lib.

@cburgmer

expected output is

[
   "first",
   "first nested",
   {
      "nested" : [
         "deepest",
         "second"
      ]
   },
   "deepest",
   "more"
]

Yes, that's correct. This query is done ignoring ordering: https://cburgmer.github.io/json-path-comparison/#bracket_notation_after_recursive_descent

As the table states "It is unclear whether results for this query have a defined order, and some implementations might apply different and even non-deterministic ordering. For comparison the results are sorted into a canonical order."

I should probably call this out in the bug reports.