Add/support forward reference resolution for array values (original) (raw)

Search before asking

Describe the bug

Issue : Implement forward reference resolution for array-based deserialization Summary

Jackson currently supports forward reference resolution (via @JsonIdentityInfo / Object Ids) for:

However, forward references are not supported for arrays like Object[].
When a forward reference appears inside an array, Jackson throws UnresolvedForwardReference instead of deferring the resolution as it does for collections.

This issue proposes adding forward-reference support to ObjectArrayDeserializer.

Motivation

Object arrays are a common data structure, especially in legacy models, binary formats, and auto-generated schemas.
Users expect forward references to behave consistently across:

List / Map / Object[]

Fields / nested structures

Mixed resolved + unresolved elements

The current behavior is inconsistent:

{
  "items": [
    { "id": 1 },
    { "@ref": 1 }
  ]
}

Works if items is a List

Fails if items is a T[]

This discrepancy forces developers to rewrite model classes or avoid arrays.

Version Information

2.14.1

Reproduction

<-- Any of the following

  1. Brief code sample/snippet: include here in preformatted/code section
  2. Longer example stored somewhere else (diff repo, snippet), add a link
  3. Textual explanation: include here
    -->