Skip to content

Add a DeserializationFeature.FAIL_ON_TRAILING_TOKENS to force reading of the whole input as single value #1583

@cowtowncoder

Description

@cowtowncoder

(note: multiple ancestor issues, f.ex #1494 -- quite commonly requested, even if indirectly)

Users would often prefer to ensure that the whole input stream would be consumed for data-binding so that error would be signaled if: there are "leftover" tokens after valid content: { } 3, or, specifically, if the whole taken into account is invalid:

"key" : 4

where just "key" would be valid JSON String, but when reading further parser detects malformed content where presumably curly braces are missing.

Now: although support for such "full reads" could be handled using multiple means -- for example, by exposing, say, readFullValue() as alternative to readValue() -- it seems preferable to use a feature to support use-cases where developer does not control method called: this is often the case when using Jackson via framework like a JAX-RS implementation. If so, dev may be able to pre-configure ObjectMapper with suitable settings to affect change in reading behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions