Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results do not match other implementations #23

Open
8 tasks
cburgmer opened this issue Feb 3, 2020 · 0 comments
Open
8 tasks

Results do not match other implementations #23

cburgmer opened this issue Feb 3, 2020 · 0 comments

Comments

@cburgmer
Copy link

cburgmer commented Feb 3, 2020

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:

    {"a": "first", "2": "second", "b": "third"}
    

    Expected output:

    ["second"]
    

    Error:

    parsing error: $.2	:1:2 - 1:4 unexpected Float while scanning operator
    
  • $[-1]
    Input:

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

    Expected output:

    ["third"]
    

    Error:

    index -1 out of bounds
    
  • $[?(@.key=='value')]
    Input:

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

    Expected output:

    [{"key": "value"}]
    

    Error:

    parsing error: $[?(@.key=='value')]	:1:12 - 1:19 could not parse string: invalid syntax
    
  • $[?(@.key)]
    Input:

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

    Expected output:

    [{"key": "value"}]
    

    Actual output:

    []
    
  • $['key']
    Input:

    {"key": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    parsing error: $['key']	:1:3 - 1:8 could not parse string: invalid syntax
    
  • $['one','three'].key
    Input:

    {"one": {"key": "value"}, "two": {"k": "v"}, "three": {"some": "more", "key": "other value"}}
    

    Expected output:

    ["value", "other value"]
    

    Error:

    parsing error: $['one','three'].key	:1:3 - 1:8 could not parse string: invalid syntax
    
  • $['two.some']
    Input:

    {"one": {"key": "value"}, "two": {"some": "more", "key": "other value"}, "two.some": "42"}
    

    Expected output:

    ["42"]
    

    Error:

    parsing error: $['two.some']	:1:3 - 1:13 could not parse string: invalid syntax
    
  • $['special:"chars']
    Input:

    {"special:\"chars": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    parsing error: $['special:"chars']	:1:3 - 1:19 could not parse string: invalid syntax
    

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

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

No branches or pull requests

1 participant