Unable to search keys containing '-' character : solution
IntelliDust opened this issue · 2 comments
IntelliDust commented
For example:
$result = (new JSONPath($data))->find('$..neighbor[?(@.neighbor-id == "192.168.1.1")]');
ends with:
PHP Fatal error: Uncaught Exception: Malformed filter query
after I replaced in QueryMatchFilter
@(\.(?<key>\w+)|\[["\']?(?<keySquare>.*?)["\']?\])
by
@(\.(?<key>\S+)|\[["\']?(?<keySquare>.*?)["\']?\])
Working like charm
fredsted commented
This also works for me to allow searching fields with periods (.
) in them, thanks!
martinssipenko commented
This project is now marked as abandoned and suggests using softcreatr/jsonpath
as a replacement. If you think this issue is still relevant please open a new ticket under the new project.