javerous / SMJJSONPath

JSONPath implementation in Objective-C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Results do not match other implementations

cburgmer opened this issue · comments

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:

    Filter: [1:3] can only be applied to arrays. Current context is: {
        ":" = 42;
        a = 1;
        b = 2;
        c = 3;
        more = string;
    }
    
  • $[:]
    Input:

    ["first", "second"]
    

    Expected output:

    ["first", "second"]
    

    Error:

    Failed to parse SliceOperation: :
    
  • $[::]
    Input:

    ["first", "second"]
    

    Expected output:

    ["first", "second"]
    

    Error:

    Failed to parse SliceOperation: ::
    
  • $[0:3:2]
    Input:

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

    Expected output:

    ["first", "third"]
    

    Actual output:

    ["first", "second", "third"]
    
  • $[',']
    Input:

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

    Expected output:

    "value"
    

    Error:

    Found empty property at index 5
    
  • $[0]['c','d']
    Input:

    [{"c": "cc1", "d": "dd1", "e": "ee1"}, {"c": "cc2", "d": "dd2", "e": "ee2"}]
    

    Expected output:

    ["cc1", "dd1"]
    

    Actual output:

    {"c": "cc1", "d": "dd1"}
    

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

I can see perfect alignment with the Java implementation :)
Do feel free to decide whether to follow up on those results or not. This issue for now is just meant to create visibility!

@cburgmer Thank you very much for this incredible work, very helpful !

So well, yes, my choice was to follow this specific Java implementation because I didn't have enough time to take my own road, and it's still the case, so I don't want to divert, and so I will stay on this choice. If they fix those problems, I will integrate the fixes in my Objective-C version ;)