jsonpath-rs icon indicating copy to clipboard operation
jsonpath-rs copied to clipboard

Results do not match other implementations

Open cburgmer opened this issue 5 years ago • 1 comments

The following queries provide results that do not match those of other implementations of JSONPath (compare https://cburgmer.github.io/json-path-comparison/):

  • [ ] $[-1:] Input:

    ["first", "second", "third"]
    

    Expected output:

    ["third"]
    

    Error:

    parsing error
    
  • [ ] $[:] Input:

    ["first", "second"]
    

    Expected output:

    ["first", "second"]
    

    Error:

    parsing error
    
  • [ ] $[1:3] Input:

    ["first", "second", "third", "forth", "fifth"]
    

    Expected output:

    ["second", "third"]
    

    Actual output:

    ["second", "third", "forth"]
    
  • [ ] $[0:1] Input:

    ["first", "second"]
    

    Expected output:

    ["first"]
    

    Actual output:

    ["first", "second"]
    
  • [ ] $[?(@.key)] Input:

    [{"some": "some value"}, {"key": "value"}]
    

    Expected output:

    [{"key": "value"}]
    

    Error:

    parsing error
    
  • [ ] $.* Input:

    {"some": "string", "int": 42, "object": {"key": "value"}, "array": [0, 1]}
    

    Expected output:

    ["string", 42, {"key": "value"}, [0, 1]]
    

    Actual output:

    [[0, 1], 42, {"key": "value"}, "string"]
    

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

cburgmer avatar Jul 22 '19 21:07 cburgmer

Hope this helps. There is more in the comparison, but you explicitly called out that not all features are currently supported, so I removed failing comparisons connected to those.

cburgmer avatar Jul 22 '19 21:07 cburgmer