-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double quotes around literal values not rejected but do not match. #26
Comments
This behaviour is the same in https://github.com/jmespath/jmespath.rb, so it's possible that the compliance tests don't cover this behaviour. |
Double quotes are reserved for selecting elements from an object that may contain special characters. For example, if I have a json document Raw string literals only work with single quotes -- e.g., Backticks are used to encapsulate valid JSON documents. Passing unquoted strings in backticks is deprecated in favor of using raw string literals. |
Ah, I see, so in my example the double quotes are valid but redundant as there is no ambiguity with a field named # This does match, because "bar" is equivalent to field bar (no quotes), which matches
JMESPath\search('[?foo == "bar"]', [['foo' => 'bar', 'bar' => 'bar']]); Thanks for the explanation. |
The literal expressions and raw string literals sections of the specification permit literals to be delimited by backticks or single quotes, but jmespath.php is partially allowing double quotes as well; no parse error is returned, but matching doesn't take place. This behaviour is possibly confusing for users that incorrectly try to use double quotes; a parse error, ideally indicating that they should use single quotes or backticks, would be more informative.
The text was updated successfully, but these errors were encountered: