Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for FAIL_ON_TRAILING_TOKENS at JsonParser level #1074

Open
pjfanning opened this issue Aug 2, 2023 · 1 comment
Open

add support for FAIL_ON_TRAILING_TOKENS at JsonParser level #1074

pjfanning opened this issue Aug 2, 2023 · 1 comment

Comments

@pjfanning
Copy link
Member

jackson-core equivalent of https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.15.2/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_TRAILING_TOKENS

It feels like jackson-core should support this too. Not just jackson-databind.

@cowtowncoder
Copy link
Member

cowtowncoder commented Aug 3, 2023

My first instinct is that I disagree, mostly from complexity of implementation. Keeping in mind that not checking this is a requirement for root-level value streaming (like line-separated JSON).

The way things are implemented I am not even sure where we would be forcing this.
I guess one possibility would be that if a feature was enabled, check was made on close()... and if (but only if!) document is completely read, next token would fail.

Compared to trying to do this at streaming level, support from databind is almost trivial: after binding full value verify that parser.nextToken() returns null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants