Open cburgmer opened 4 years ago
I can try to fix the last case first
Due to the streaming nature of JsonSurfer, Case 2 and 3 with negative step are very hard to implement
Just out of curiosity, for a query $[-n]
you could keep a window with n
entries. When the stream stops you pick the first entry from that window and have your candidate.
The upper memory limit for the window would depend on the size of the entries in the list you are processing. This is very likely no different to what you are currently doing, just n
times (= constant) more.
Cool. It does make sense. I will try.
I've just reviewed source code and couldn't figure out a quick fix. So Case 2 & 3 won't be supported in near release
The following queries provide results that do not match those of other implementations of JSONPath (compare https://cburgmer.github.io/json-path-comparison/):
[x]
$.2
Input:Expected output:
Error:
[ ]
$[-1]
Input:Expected output:
Actual output:
[ ]
$[-1:]
Input:Expected output:
Actual output:
[x]
$[?(@.key=="some.value")]
Input:Expected output:
Error:
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Java_com.github.jsurfer.