Skip to content

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

@pts-kevinqiu

Description

@pts-kevinqiu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions