jmespath / jmespath/jmespath.js
Single vs double quotes
- Dominant language
- JavaScript
- Stars
- 847
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
In the following JSON:
```
[
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Organization name"
},
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Website name"
}
]
```
I'm trying to get the `name` value for the first object (i.e., `"Organization name"`). I'm using https://jmespath.org/ but I'm posting here as I assume it uses `jmespath.js`.
I understand this expression won't work because `@` has a special meaning: `[?@type=='Organization'].author.name` (it fails).
But this expression does not work either: `[?'@type'=='Organization'].author.name` (it returns `[]`).
This expression does work: `[?"@type"=='Organization'].author.name`...
...but this one doesn't: `[?"@type"=="Organization"].author.name` (it returns `[]`).
There seems to be some inconsistency regarding where double quotes and where single quotes should be used.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.