No, for two reasons:

1. JsonNode is singly linked, only parent -> child linkage (not a
problem for root node itself, but in general)
2. JsonNode does not have JsonLocation, since this is not needed in general

to get location information, you need to use JsonParser directly, or
sub-class JsonNode implementation and JsonNodeFactory. Latter might be
doable as you can add property to hold location information But you'd
need to build the tree yourself from JsonParser: this is not very
complicated (JsonNodeDeserializer shows how to do it, although it's
more complicated than what you'd need).

-+ Tatu +-



On Sat, Nov 12, 2016 at 9:13 AM,
<list+com.fasterxml.jackson-u...@io7m.com> wrote:
> Hello.
>
> Let's assume I've received an ObjectNode representing the root of a
> parsed JSON document. I want to extract data from that ObjectNode and
> therefore I'm going to be manually traversing the tree and unmarshaling
> fields manually. The JSON document doesn't have a schema, so I'm
> essentially stuck doing ad-hoc validation when I try to unmarshal
> fields. In order to avoid driving my users mad, I want to give good
> error messages such as:
>
>   error: Expected an integer value but got a string
>     Position: file.json:23:0
>     Key:      example_key
>
> Can I actually do this if I only have access to the ObjectNode? I don't
> see any obvious way to recover line and column numbers via the API.
>
> M
>
> --
> 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 jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to