The following queries provide results that do not match those of other implementations of JSONPath (compare https://cburgmer.github.io/json-path-comparison/): - [x] `$[1:10]` Input: ``` ["first", "second", "third"] ``` Expected output: ``` ["second", "third"] ``` Error: ``` sed: bad regex '\[(([0-9]+|"[^"]+")[],]){9999}(.*)': Invalid contents of {} No JSON object could be decoded ``` - [ ] `$[-1:]` Input: ``` ["first", "second", "third"] ``` Expected output: ``` ["third"] ``` Actual output: ``` ["first", "second", "third"] ``` - [x] `$[1:]` Input: ``` ["first", "second", "third", "forth", "fifth"] ``` Expected output: ``` ["second", "third", "forth", "fifth"] ``` Error: ``` sed: bad regex '\[(([0-9]+|"[^"]+")[],]){9999}(.*)': Invalid contents of {} No JSON object could be decoded ``` - [x] `$[0:3:2]` Input: ``` ["first", "second", "third", "forth", "fifth"] ``` Expected output: ``` ["first", "third"] ``` Actual output: ``` ["first", "second", "third", "forth", "fifth"] ``` - [x] `$[0:3:1]` Input: ``` ["first", "second", "third", "forth", "fifth"] ``` Expected output: ``` ["first", "second", "third"] ``` Actual output: ``` ["first", "second", "third", "forth", "fifth"] ``` - [x] `$['key']` Input: ``` {"key": "value"} ``` Expected output: ``` ["value"] ``` Actual output: ``` {"key": "value"} ``` - [x] `$['key','another']` Input: ``` {"key": "value", "another": "entry"} ``` Expected output: ``` ["value", "entry"] ``` Actual output: ``` {"another": "entry", "key": "value"} ``` - [ ] `$['0']` Input: ``` {"0": "value"} ``` Expected output: ``` ["value"] ``` Error: ``` sed: bad regex '\[(([0-9]+|"[^"]+")[],]){9999}(.*)': Invalid contents of {} No JSON object could be decoded ``` - [ ] `$['special:"chars']` Input: ``` {"special:\"chars": "value"} ``` Expected output: ``` ["value"] ``` Error: ``` sed: bad regex '\[(([0-9]+|"[^"]+")[],]){9999}(.*)': Invalid contents of {} No JSON object could be decoded ``` - [ ] `$['*']` Input: ``` {"*": "value"} ``` Expected output: ``` ["value"] ``` Actual output: ``` {"*": "value"} ``` - [x] `$.key` Input: ``` {"key": "value"} ``` Expected output: ``` ["value"] ``` Actual output: ``` {"key": "value"} ``` - [x] `$.key` Input: ``` {"key": ["first", "second"]} ``` Expected output: ``` [["first", "second"]] ``` Actual output: ``` ["first", "second"] ``` - [ ] `$.key` Input: ``` {"key": null} ``` Expected output: ``` [null] ``` Actual output: ``` {"key": null} ``` - [ ] `$..key` Input: ``` {"object": {"key": "value", "array": [{"key": "something"}, {"key": {"key": "russian dolls"}}]}, "key": "top"} ``` Expected output: ``` ["top", "value", "something", {"key": "russian dolls"}, "russian dolls"] ``` Actual output: ``` {"key": "top", "object": {"array": [{"key": "something"}, {"key": {"key": "russian dolls"}}], "key": "value"}} ``` - [ ] `$.store..price` Input: ``` {"store": {"book": [{"category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95}, {"category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99}, {"category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99}, {"category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "isbn": "0-395-19395-8", "price": 22.99}], "bicycle": {"color": "red", "price": 19.95}}} ``` Expected output: ``` [8.95, 12.99, 8.99, 22.99, 19.95] ``` Actual output: ``` {"bicycle": {"price": 19.95}, "book": [{"price": 8.95}, {"price": 12.99}, {"price": 8.99}, {"price": 22.99}]} ``` - [ ] `$` Input: ``` {"key": "value", "another key": {"complex": ["a", 1]}} ``` Expected output: ``` [{"another key": {"complex": ["a", 1]}, "key": "value"}] ``` Error: ``` sed: bad regex '\[(([0-9]+|"[^"]+")[],]){9999}(.*)': Invalid contents of {} No JSON object could be decoded ``` - [x] `$[*]` Input: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Expected output: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Error: ``` Extra data: line 4 column 6 - line 12 column 1 (char 28 - 94) ``` - [x] `$[*]` Input: ``` {"some": "string", "int": 42, "object": {"key": "value"}, "array": [0, 1]} ``` Expected output: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Actual output: ``` {"array": [0, 1], "int": 42, "object": {"key": "value"}, "some": "string"} ``` - [x] `$.*` Input: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Expected output: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Error: ``` Extra data: line 4 column 6 - line 12 column 1 (char 28 - 94) ``` - [x] `$.*` Input: ``` {"some": "string", "int": 42, "object": {"key": "value"}, "array": [0, 1]} ``` Expected output: ``` ["string", 42, {"key": "value"}, [0, 1]] ``` Actual output: ``` {"array": [0, 1], "int": 42, "object": {"key": "value"}, "some": "string"} ``` For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/Bash_JSONPath.sh/implementations/Bash_JSONPath.sh.
The following queries provide results that do not match those of other implementations of JSONPath
(compare https://cburgmer.github.io/json-path-comparison/):
$[1:10]Input:
Expected output:
Error:
$[-1:]Input:
Expected output:
Actual output:
$[1:]Input:
Expected output:
Error:
$[0:3:2]Input:
Expected output:
Actual output:
$[0:3:1]Input:
Expected output:
Actual output:
$['key']Input:
Expected output:
Actual output:
$['key','another']Input:
Expected output:
Actual output:
$['0']Input:
Expected output:
Error:
$['special:"chars']Input:
Expected output:
Error:
$['*']Input:
Expected output:
Actual output:
$.keyInput:
Expected output:
Actual output:
$.keyInput:
Expected output:
Actual output:
$.keyInput:
Expected output:
Actual output:
$..keyInput:
Expected output:
Actual output:
$.store..priceInput:
Expected output:
Actual output:
$Input:
Expected output:
Error:
$[*]Input:
Expected output:
Error:
$[*]Input:
Expected output:
Actual output:
$.*Input:
Expected output:
Error:
$.*Input:
Expected output:
Actual output:
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/Bash_JSONPath.sh/implementations/Bash_JSONPath.sh.