On Mon, Oct 14, 2019 at 9:56 PM Philip Roc <[email protected]> wrote:
>
> Hello,
> let's assume a JSON structure containing a list of people, each having
> favorite foods, hobbies, and speaking one or more foreign languages.
> I would like to retrieve data using a path-like syntax. For example:
> person[0].hobbies.*,person[1].foods.*, meaning "retrieve person 0's hobbies
> and foods [but not their foreign languages]".
> Another example, - person[*].hobbies, - person[*].languages, meaning "delete
> all persons'hobbies and languages [but retrieve their favorite foods].
> Can such queries be made with the Jackson Java API? If so, how? If not, can
> you recommend another API?
Jackson does support simpler reference language, JSONPointer, so you
can find single value nodes, like:
String firstPersonName =
mapper.readTree().at("/personnel/0/name/first").asString();
but otherwise stays out of more complex querying, matching and traversal.
I know there are many packages that support more complex querying
(like JsonPath), but am not very familiar with best ones available
currently.
Maybe others can share libraries they know of.
-+ Tatu +-
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/CAL4a10imy14On86i%3DN5oj0KnF619%2BbcgDu7TGXJ1RVH_FqP%3Dew%40mail.gmail.com.