Title: Jackson 3: FAIL_ON_TRAILING_TOKENS default flip not compensated in main-source parsers (JSONataUtils.loadJSONFile + CLI) · Issue #435 · IBM/JSONata4Java · GitHub
Open Graph Title: Jackson 3: FAIL_ON_TRAILING_TOKENS default flip not compensated in main-source parsers (JSONataUtils.loadJSONFile + CLI) · Issue #435 · IBM/JSONata4Java
X Title: Jackson 3: FAIL_ON_TRAILING_TOKENS default flip not compensated in main-source parsers (JSONataUtils.loadJSONFile + CLI) · Issue #435 · IBM/JSONata4Java
Description: Summary Jackson 3 flips the FAIL_ON_TRAILING_TOKENS deserialization default from false (Jackson 2) to true. During the migration (#430, PR #431) this leniency was restored on exactly one test mapper (src/test/java/.../expressions/utils/U...
Open Graph Description: Summary Jackson 3 flips the FAIL_ON_TRAILING_TOKENS deserialization default from false (Jackson 2) to true. During the migration (#430, PR #431) this leniency was restored on exactly one test mappe...
X Description: Summary Jackson 3 flips the FAIL_ON_TRAILING_TOKENS deserialization default from false (Jackson 2) to true. During the migration (#430, PR #431) this leniency was restored on exactly one test mappe...
Opengraph URL: https://github.com/IBM/JSONata4Java/issues/435
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Jackson 3: FAIL_ON_TRAILING_TOKENS default flip not compensated in main-source parsers (JSONataUtils.loadJSONFile + CLI)","articleBody":"## Summary\n\nJackson 3 flips the `FAIL_ON_TRAILING_TOKENS` deserialization default from `false` (Jackson 2) to `true`. During the migration (#430, PR #431) this leniency was restored on exactly **one** test mapper (`src/test/java/.../expressions/utils/Utils.java:83`) but was **not** restored on the main‑source parse paths, so those became stricter than under Jackson 2. Content after the first parsed value (trailing tokens / trailing typos / concatenated values) that Jackson 2 silently ignored now throws at runtime.\n\nThe core public evaluate path is unaffected (it takes a pre‑parsed `JsonNode`), which is why the test suite stayed green. The exposure is in the file/string loaders below.\n\n## Where\n\n### Main source (production / public API)\n\n- **`src/main/java/com/api/jsonata4java/JSONataUtils.java:374`** — `loadJSONFile` uses `new ObjectMapper().readValue(br, Object.class)`. This is a **public utility** used to load `.json` files. A file that loaded fine under 2.x (trailing whitespace‑separated token, two concatenated values, etc.) now throws a trailing‑token error. **Highest impact.**\n- `src/main/java/com/api/jsonata4java/Tester.java:123` — the mapper was faithfully rebuilt for `ESCAPE_NON_ASCII` but does **not** disable `FAIL_ON_TRAILING_TOKENS`. Clearest evidence the flag flip was known (fixed in test `Utils`) but applied inconsistently. CLI tool, lower impact.\n- `src/main/java/com/api/jsonata4java/TesterTimeBox.java:121` — `new ObjectMapper()` for `readTree`. CLI tool.\n- `src/main/java/com/api/jsonata4java/testerui/TesterUI.java` and `Test.java` — same pattern; demo/UI, low impact.\n\n### Test source (latent inconsistency)\n\n- `src/test/java/.../expressions/utils/Utils.java:76` (`getJson`) and `:247` (`toJson`) still use bare `new ObjectMapper()` while the sibling `mapper` field (line 83) disables `FAIL_ON_TRAILING_TOKENS`. Same file, divergent parsing. Currently latent (both helpers are unreferenced), but it undermines the \"parse identically to Jackson 2\" intent stated in the line‑83 comment.\n\n## Verified\n\n`FAIL_ON_TRAILING_TOKENS` defaults to `true` in jackson‑databind 3.2.0 (bytecode: `iconst_1` in the enum init) vs `false` in Jackson 2. Only `Utils.java:83` compensates.\n\n## Suggested fix\n\nIntroduce a single shared \"Jackson‑2‑compatible\" mapper factory (disabling `FAIL_ON_TRAILING_TOKENS`, and centralizing `ESCAPE_NON_ASCII` etc.) and route all parse sites through it — at minimum `JSONataUtils.loadJSONFile`, and the `Utils.java` `getJson`/`toJson` helpers, so parsing behavior no longer diverges by call site. This also addresses the duplicated builder configuration noted during review (identical `JsonMapper.builder()...` blocks now appear in `AgnosticTestSuite` and `Tester`).\n","author":{"url":"https://github.com/wnm3","@type":"Person","name":"wnm3"},"datePublished":"2026-07-07T16:39:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/435/JSONata4Java/issues/435"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8ab9cd96-7cf9-7aa6-db76-67b3589e037c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 972C:E2378:429D3F3:5B94A28:6A4F4591 |
| html-safe-nonce | 68030dfde3bcff63d54c5855e064f83a48cf0543d1801fe7f986d69465984339 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzJDOkUyMzc4OjQyOUQzRjM6NUI5NEEyODo2QTRGNDU5MSIsInZpc2l0b3JfaWQiOiIzMDU4MzA3NjM2MTQ1Mzc0NjA5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 37dcfd9061e2c4def11529c483e06f968d20170cc4aaf0e3525b34da8601ba27 |
| hovercard-subject-tag | issue:4830456731 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IBM/JSONata4Java/435/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ad68f17df4aaec207e77d50d99d537c6af1b2cd50c781d11307dc36c1e8e47e/IBM/JSONata4Java/issues/435 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ad68f17df4aaec207e77d50d99d537c6af1b2cd50c781d11307dc36c1e8e47e/IBM/JSONata4Java/issues/435 |
| og:image:alt | Summary Jackson 3 flips the FAIL_ON_TRAILING_TOKENS deserialization default from false (Jackson 2) to true. During the migration (#430, PR #431) this leniency was restored on exactly one test mappe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wnm3 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/IBM/JSONata4Java git https://github.com/IBM/JSONata4Java.git |
| octolytics-dimension-user_id | 1459110 |
| octolytics-dimension-user_login | IBM |
| octolytics-dimension-repository_id | 169904880 |
| octolytics-dimension-repository_nwo | IBM/JSONata4Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 169904880 |
| octolytics-dimension-repository_network_root_nwo | IBM/JSONata4Java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width