Skip to content

Results do not match other implementations #20

@cburgmer

Description

@cburgmer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions