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 #20

Open
4 of 10 tasks
cburgmer opened this issue May 1, 2020 · 1 comment
Open
4 of 10 tasks

Results do not match other implementations #20

cburgmer opened this issue May 1, 2020 · 1 comment

Comments

@cburgmer
Copy link

cburgmer commented May 1, 2020

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

  • $[1:3]
    Input:

    {":": 42, "more": "string", "a": 1, "b": 2, "c": 3}
    

    Expected output:

    []
    

    Error:

    ** (Poison.EncodeError) unable to encode value: {"b", 2}
        lib/poison/encoder.ex:383: Poison.Encoder.Any.encode/2
        lib/poison/encoder.ex:259: anonymous fn/3 in Poison.Encoder.List.encode/3
        lib/poison/encoder.ex:260: Poison.Encoder.List."-encode/3-lists^foldr/2-1-"/3
        lib/poison/encoder.ex:260: Poison.Encoder.List.encode/3
        lib/poison.ex:41: Poison.encode!/2
        lib/jsonpath.ex:8: Mix.Tasks.Execute.run/1
    
  • $[0:0]
    Input:

    ["first", "second"]
    

    Expected output:

    []
    

    Actual output:

    ["first", "second"]
    
  • $[-4:]
    Input:

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

    Expected output:

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

    Actual output:

    []
    
  • $..[0]
    Input:

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

    Expected output (in any order as no consensus on ordering exists):

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

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "syntax error before: '['"}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    
  • $[*]
    Input:

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

    Expected output:

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

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "syntax error before: '*'"}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    
  • $.key-dash
    Input:

    {"key-dash": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "illegal characters \"-d\""}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    
  • $.屬性
    Input:

    {"\u5c6c\u6027": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "illegal characters \"屬\""}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    
  • $.2
    Input:

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

    Expected output:

    ["second"]
    

    Actual output:

    []
    
  • $..*
    Input:

    {"key": "value", "another key": {"complex": "string", "primitives": [0, 1]}}
    

    Expected output (in any order as no consensus on ordering exists):

    ["string", "value", 0, 1, [0, 1], {"complex": "string", "primitives": [0, 1]}]
    

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "syntax error before: '*'"}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    
  • $
    Input:

    {"key": "value", "another key": {"complex": ["a", 1]}}
    

    Expected output:

    [{"another key": {"complex": ["a", 1]}, "key": "value"}]
    

    Error:

    ** (MatchError) no match of right hand side value: {:error, %ExJSONPath.ParsingError{message: "syntax error before: "}}
        lib/jsonpath.ex:7: Mix.Tasks.Execute.run/1
    

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

@bettio
Copy link
Collaborator

bettio commented Jul 13, 2020

Thank you for reporting all these issues, I'll look into them.

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

2 participants