Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Results do not match other implementations #39

Open
5 of 6 tasks
cburgmer opened this issue Jul 14, 2019 · 2 comments
Open
5 of 6 tasks

Results do not match other implementations #39

cburgmer opened this issue Jul 14, 2019 · 2 comments

Comments

@cburgmer
Copy link

cburgmer commented Jul 14, 2019

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

  • $[:2]
    Input:

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

    Expected output:

    ["first", "second"]
    

    Actual output:

    ["first", "second", "third"]
    
  • $[1:3]
    Input:

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

    Expected output:

    ["second", "third"]
    

    Actual output:

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

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

    Expected output:

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

    Actual output:

    ["first", "second", "third", "forth"]
    
  • $[0:4:2]
    Input:

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

    Expected output:

    ["first", "third"]
    

    Actual output:

    ["first", "third", "fifth"]
    
  • $[0:1]
    Input:

    ["first", "second"]
    

    Expected output:

    ["first"]
    

    Actual output:

    ["first", "second"]
    
  • $['key','another']
    Input:

    {"key": "value", "another": "entry"}
    

    Expected output:

    ["value", "entry"]
    

    Actual output:

    []
    

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

@stephenfrank
Copy link
Contributor

Hi... this is a helpful comparison. I had really misunderstood what the second argument of the slice operator does! I've checked the implementation against Python which I think is the standard implementation of this.

The only thing I'm not able to do immediately is extend/rewrite the parser to support the multiple string index implementation.

@martinssipenko
Copy link
Contributor

This project is now marked as abandoned and suggests using softcreatr/jsonpath as a replacement. If you think this issue is still relevant please open a new ticket under the new project.

https://github.com/SoftCreatR/JSONPath

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants