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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

result.Paths(json string) does not return paths when used more than one #'s #298

Open
tanmaymishu opened this issue Oct 21, 2022 · 1 comment

Comments

@tanmaymishu
Copy link

Hi, amazing work 馃憤

I have the following json:

{
  "people": [
    {"name": "John", "addresses": [{"zip": 123}]}
  ]
}

When I try to access the name property inside people, result.Paths() returns a slice of strings containing the path like this:

result := gjson.Get(string(json), field)
fmt.Println(result.Paths(string(json)))

people.#.name
[people.0.name]

However when I do the same for the zip inside the addresses array,

people.#.addresses.#.zip

the result.Paths() no longer returns a slice of strings.

Is this a known limitation? If so, is there a workaround for this?

@tanmaymishu
Copy link
Author

Looks like there is a similar issue: #267

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

1 participant