Skip to content

Add JsonPointer annotation for nested binding - #358

Open
arnabnandy7 wants to merge 1 commit into
FasterXML:2.xfrom
arnabnandy7:feature/json-pointer-binding
Open

Add JsonPointer annotation for nested binding#358
arnabnandy7 wants to merge 1 commit into
FasterXML:2.xfrom
arnabnandy7:feature/json-pointer-binding

Conversation

@arnabnandy7

@arnabnandy7 arnabnandy7 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Adds a new @JsonPointer annotation for selecting a nested JSON value during property deserialization using JSON Pointer syntax.

Part of #357.

Example

Given:

{
  "employee": {
    "details": {
      "departmentId": 123
    }
  }
}

A property can declare its source using:

public class Employee {
    @JsonPointer("/employee/details/departmentId")
    public int departmentId;
}

Changes

  • Add the @JsonPointer annotation.
  • Support fields, methods, parameters, and bundled annotations.
  • Document RFC 6901 escaping rules.
  • Define initial semantics:
    • The annotation affects deserialization only.
    • A missing pointer target is treated as an absent property.
    • An explicit JSON null is handled as a normal null property value.
  • Add reflection tests for annotation targets and runtime retention.
  • Update the 2.23 release notes.

Implementation note

I've defined the annotation and its semantics only. Actual JSON Pointer traversal and property binding implemented separately in jackson-databind in FasterXML/jackson-databind#6161

Testing

./mvnw -Dtest=JsonPointerTest test

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
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

Successfully merging this pull request may close these issues.

1 participant