PaesslerAG / jsonpath

BSD 3-Clause "New" or "Revised" License
172 stars 37 forks source link

Honor JSON annotations #30

Open catalin-me opened 3 years ago

catalin-me commented 3 years ago

Hello,

I have this struct with the following JSON annotations:

MyFancyStruct struct {
    SomeNestedProperty []map[string]interface{} `json:"someNestedProperty,omitempty,nocopy"`
}

And this JSONPath:

$.someNestedProperty[*][*].some_other_prop

If I do the following:

JSONPathResults, err := jsonpath.Get("$.someNestedProperty[*][*].some_other_prop", myFancyStructInstance)

It won't find anything for obvious reasons, because it's searching for someNestedProperty on the struct with the first letter of the property uppercase.

🤔 Is it possible to enforce honoring JSON annotations? Please excuse my ignorance for not diving right into the code.