JSONPath
JSONPath copied to clipboard
JSONPath implementation for PHP.
Test Data: ```json [ { "address": { "city": "Berlin" } }, { "address": { "city": "London" } } ] ``` Selector: ``` $[?(@.address.city=='Berlin')] ``` Result: ```diff --- Expected +++ Actual...
Test Data: ```json [ "one element" ] ``` Selector: ``` $[-2] ``` Result: ```diff Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'[]' +'["one element","one...
Test Data: ```json { "items":[ { "key1":10, "key2":10 }, { "key1":42, "key2":50 } ] } ``` Selector: ``` $.items[?(@[email protected])] ``` Result: ```diff --- Expected +++ Actual @@ @@ - [{"key1":10,"key2":10}]...
## 🐛 Bug Report Since we upgraded `softcreatr/jsonpath` to `^0.7.2`, we noticed that some type checks were added to the `JsonPath` object (which is awesome 😍). Here's the issue ```php...
Test Data: ```json [ "first", "second", "third", "forth", "fifth" ] ``` Selector: ``` $[*,1] ``` Resul: ``` Unable to parse token *,1 in expression: [*,1] ``` Expected result (Proposal A):...
Test Data: ```json [ 1, 2, 3, 4, 5 ] ``` Selector: ``` $[1:3,4] ``` Result (Proposal A): ```diff --- Expected +++ Actual @@ @@ -'[2,3,5]' +'[2,3]' ``` https://cburgmer.github.io/json-path-comparison/results/union_with_slice_and_number.html
Test Data: ```json { "a":[ "string", null, true ], "b":[ false, "string", 5.4 ] } ``` Selector: ``` $.*[0,:5] ``` Result (Proposal A): ```diff --- Expected +++ Actual @@ @@...
Test Data: ```json [ { "key":1 }, { "key":8 }, { "key":3 }, { "key":10 }, { "key":7 }, { "key":2 }, { "key":6 }, { "key":4 } ] ```...
Test Data: ```json [ { "some":"some value" }, { "key":true }, { "key":false }, { "key":null }, { "key":"value" }, { "key":"" }, { "key":0 }, { "key":1 }, {...
Test Data: ```json [ { "key":0 }, { "key":42 }, { "key":-1 }, { "key":1 }, { "key":41 }, { "key":43 }, { "key":42.0001 }, { "key":41.9999 }, { "key":100...