Comments (3)
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.
from jmespath.php.
Double quotes are reserved for selecting elements from an object that may contain special characters. For example, if I have a json document {"foo.bar": "baz"}
and I wanted the value of "foo.bar", then I would need to place "foo.bar" in double quotes to prevent JMESPath from treating the "." as a subexpression. So given the expression "foo.bar"
, JMESPath will return "baz".
Raw string literals only work with single quotes -- e.g., 'foo.bar'
will create the literal value of a string containing "foo.bar".
Backticks are used to encapsulate valid JSON documents. Passing unquoted strings in backticks is deprecated in favor of using raw string literals.
from jmespath.php.
Ah, I see, so in my example the double quotes are valid but redundant as there is no ambiguity with a field named bar
anyway. JMESPath tries to match the field foo
against the field bar
, but as there is no bar
the match fails and no result is returned.
# 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.
from jmespath.php.
Related Issues (20)
- Composer install shows warning this package has an issue. HOT 2
- Env.php is missing in src folder HOT 2
- security issue HOT 2
- How can i access the key that includes @? HOT 2
- Syntax error. Unexpected "unknown" token (nud_unknown)
- Invalid autoload.php path in jp.php HOT 1
- Whitespace character handling HOT 1
- Support unicode characters in length function
- Combined syntax compliance
- Syntax errors with hypens in object key HOT 5
- No such a file on composer install or update HOT 3
- aws/aws-sdk-php issues due to this file HOT 2
- Support PHP stream wrappers for defining runtime compile folder HOT 6
- Unexpected empty array returned on expression rather than NULL
- set values HOT 1
- Composer error HOT 6
- Edge Case: SyntaxErrorException throws ValueError in PHP 8
- Install of mtdowling/jmespath.php failed HOT 2
- Implement boolean strict option in search flow
- Severity: Notice --> Undefined index: unknown .../Parser.php 98
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jmespath.php.