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

use jsonpath as key #234

Open
bartsimp opened this issue Aug 6, 2021 · 2 comments
Open

use jsonpath as key #234

bartsimp opened this issue Aug 6, 2021 · 2 comments

Comments

@bartsimp
Copy link

bartsimp commented Aug 6, 2021

Hello,

it's possible to use a jsonpath notation to perform the lookup?

jsonparser.Get(data, "$.person.name.fullName")

equivalent to:

jsonparser.Get(data, "person", "name", "fullName")

regards

@buger
Copy link
Owner

buger commented Aug 6, 2021

What about adding helper like this?

func JSONPath(path) {
  return strings.Split(strings.TrimPrefix(path, "$."), ".")
}
....
jsonparser.Get(data, JSONPath("$.person.name.fullName")...)

@tedyu
Copy link

tedyu commented Dec 27, 2023

Is there recent development to support jsonpath ?
I wonder if I can use @.length to access array length.

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

3 participants