Closed sschulz-t closed 11 months ago
Looks like a bug. I suspect it has something to do with the transition from reflection on the struct to the map data. I'll take a look and get it fixed.
It looks like the descent ..
expression does not traverse struct fields. That will take a bit longer to implement but I will put it in the queue to be done.
Thanks for the quick response! As a temporary workaround, I marshal and unmarshal the object and feed jsonpath with that :)
Will the fixed descent use the struct key name or the json decorator (e.g., type obj struct { Some string json:"city"
}) as well?
If there is a decorator it will be used otherwise the field name as lower case or what ever the options specify.
The struct-path has a fix. Still needs some testing but should work.
v1.20.0 released with the fix.
Can this be closed?
I am facing an issue with matching a json path with a recursive descent (e.g., $..city) against a go object. See the following minimal example code (or use this go playground link: https://go.dev/play/p/mtIWc1-iNz3 )
I expected x.Get(o) to resolve to the city as well. However, it does not.
Is this a bug or is it expected that it does not recurse into the struct's keys (e.g., o.Data) on its own?