Skip to content

Single vs double quotes #86

Open
Open
@diegodlh

Description

@diegodlh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions