-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Hi & thanks for your work sharing this library!
I have a use-case where I'd like to be able to fetch data from either a raw API response (in dict
s, list
s, and other JSON-native types), OR from an already-parsed Pydantic model (even better if arbitrary Python classes/objects supported too).
It seems from the Descendents.find
implementation like jsonpath-ng
explicitly does not support fetching data from plain Python objects (for example using getattr(datum.value, field)
instead of datum.value[field]
). Would it be possible to enable this?
It is fair that there are some potentially funky edge cases here, because you'd be able to retrieve properties & methods from native objects (For example $.num.real.real.real.real
... on {"num": 13}
)... So maybe it'd be necessary to put the ability to traverse plain objects behind a configuration option in parse()
, and leave it turned off by default? That'd still un-block our use-case.