I using JSONPath with PHP and i need the xpath equivalent to the contains filter, "contains(dept, 'Management')";
I have the following JSON and i want to filter the staff members to the Management Dept only. If the department node only contains 1 department then it's no problem, but i need find the keyword within department string?
Any help would be appreciated.
{
"staff": {
"members": [
{
"firstname": "J",
"lastname": "H",
"department": "Management, Finance"
},
{
"firstname": "S",
"lastname": "M",
"department": "Finance"
}
]
}
}
$parser->setPath("$..members[?(@['department']=='Management')]");
$staff = $parser->getData();
var_dump($staff);