Skip to content

Results do not match other implementations #15

@cburgmer

Description

@cburgmer

Results do not match other implementations

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:

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

    Expected output:

    ["second", "third"]
    

    Actual output:

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

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

    Expected output:

    ["first", "second"]
    

    Error:

    JSON path parse error at position 1
    
  • $[0:0]
    Input:

    ["first", "second"]
    

    Expected output:

    []
    

    Actual output:

    ["first"]
    
  • $[0:3:2]
    Input:

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

    Expected output:

    ["first", "third"]
    

    Error:

    JSON path parse error at position 1
    
  • $..[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"]}]
    

    Actual output:

    ["deepest", "first nested", "more", {"nested": ["deepest", "second"]}]
    
  • $["key"]
    Input:

    {"key": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    JSON path parse error at position 1
    
  • $['']
    Input:

    {"": 42, "''": 123, "\"\"": 222}
    

    Expected output:

    [42]
    

    Error:

    JSON path parse error at position 1
    
  • $[-1]
    Input:

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

    Expected output:

    ["third"]
    

    Error:

    JSON path parse error at position 1
    
  • $..key
    Input:

    {"object": {"key": "value", "array": [{"key": "something"}, {"key": {"key": "russian dolls"}}]}, "key": "top"}
    

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

    ["russian dolls", "something", "top", "value", {"key": "russian dolls"}]
    

    Actual output:

    ["russian dolls", "something", "value", {"key": "russian dolls"}]
    
  • $.key-dash
    Input:

    {"key-dash": "value"}
    

    Expected output:

    ["value"]
    

    Error:

    JSON path parse error at position 5
    
  • $.2
    Input:

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

    Expected output:

    ["second"]
    

    Error:

    JSON path parse error at position 1
    
  • $..*
    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]}]
    

    Actual output:

    ["string", 0, 1, [0, 1]]
    
  • $..*
    Input:

    [40, null, 42]
    

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

    [40, 42, null]
    

    Actual output:

    []
    
  • $['key','another']
    Input:

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

    Expected output:

    ["value", "entry"]
    

    Error:

    JSON path parse error at position 1
    
  • $[ 0 , 1 ]
    Input:

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

    Expected output:

    ["first", "second"]
    

    Error:

    JSON path parse error at position 1
    

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions