There are couple of ways, depending on exactly what you are trying to do.
Since you talk about node, there is a way to get `JsonParser` out of
`JsonNode`:
JsonParser p = node.traverse();
But if you meant as general value of the logical JSON document (sometimes
called "sub-tree"), it is possible to bind data from a node. Simply use:
Map<String, Object> map = objectMapper.readValue(jsonParser, Map.class);
and only the tree that parser points to (or will point to while advancing
to the first token, if not yet pointing to one) will be bound. You can
first advance parser to whatever location you want, then bind, repeat if
necessary.
Finally: there is even a way to get a "view" to such sub-tree, to get a
JsonParser that only exposes part of the original document.
This can be done using `FilteringParserDelegate`:
JsonParser view = new FilteringParserDelegate(originalParser, filter,
false, false); // check javadocs for these params
and using a JsonPointer based filter:
JsonPointerBasedFilter filter = new
JsonPointerBasedFilter("/root/child");
Hope this helps,
-+ Tatu +-
On Sat, Aug 27, 2016 at 5:26 AM, <[email protected]> wrote:
> While deserialing I have to create parser that represent current json node
> only, not entire remaing json stream.
> Is there a outofbox solution or any other way to achive this.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"jackson-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.