Search code examples
phpcodeignitercodeigniter-3jsonpath

JSONPath PHP gives false


I've been using JSONPath in my Codeigniter 3 Project. I want to find the result of an expression.

Now, coming to the issue. The Same expression works on an online json evaluator. But the same expression used during the code results into false.

Here's the expression

$.slots[?((('2035-05-16 08:00' >= @.slot_datetime_from && '2035-05-16 08:00' < @.slot_datetime_to) || ('2035-05-16 12:30' > @.slot_datetime_from && '2035-05-16 12:30' <= @.slot_datetime_to) ) && @.venue_id == '1' && @.court_id == '1')]

I'm using one JSON. Here's the link

Here's the code which I'm using.

$existingEntries = new JsonObject($existingSlotAndCourtEntries);
$result = $existingEntries->{$exp};

Solution

  • Here's the answer. The author of the library answered it himself.

    Github link