Skip to content
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

Unable to parse dict.*.key type query #44

Closed
pts-kevinqiu opened this issue Apr 10, 2017 · 2 comments
Closed

Unable to parse dict.*.key type query #44

pts-kevinqiu opened this issue Apr 10, 2017 · 2 comments

Comments

@pts-kevinqiu
Copy link

Here's a sample script:

require 'jsonpath'

json = <<-HEREDOC
{
  "nodes": {
    "foo": {
      "duh": 1
    },
    "bar": {
      "duh": 2
    },
    "quux": {
      "duh": 3
    }
  }
}
HEREDOC

path = JsonPath.new('$.nodes.*.duh')
puts path.on(json)

Running the script produces empty result, while I'm expecting [1, 2, 3]. Testing the json on http://www.jsonquerytool.com/#/JSONPath gives me the right result:

image

@Skarlso
Copy link
Collaborator

Skarlso commented May 1, 2017

Yes, intermediary wildcards aren't working yet. You can work around this using [?(@)] for new instead of the *. I'll try to work out a nicer way of doing it.

Skarlso added a commit to Skarlso/jsonpath that referenced this issue May 1, 2017
@Skarlso
Copy link
Collaborator

Skarlso commented May 1, 2017

Fixed this in an upcoming PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants