mdaverde / jsonpath

jsonpath golang library to help with getting and setting values on paths (even nonexistent paths)
https://pkg.go.dev/github.com/mdaverde/jsonpath
MIT License
22 stars 5 forks source link

Any plan to support Bracket-notated child or children #4

Open chace20 opened 6 months ago

chace20 commented 6 months ago

Hi, I found you work only support '.' to get child, is there any plan to support '[]'?

var pathDelimiter = "."

Such like that:

JsonPath expressions can use the dot–notation $.store.book[0].title or the bracket–notation $['store']['book'][0]['title']

https://github.com/json-path/JsonPath

mdaverde commented 4 months ago

Hi @chace20

I recently came across Ojg which seems to be up to spec with the JSONPath RFC. This should be able to handle any well-formed query. Have you tried it?