Skip to content

Add serialization support for @JsonUnwrapped with ObjectNodeΒ #3196

Closed
@cowtowncoder

Description

@cowtowncoder

Currently @JsonUnwrapped has no effect on ObjectNode (or JsonNode) valued property.
Although in general JsonNode is to be handled as-is, with minimal changes (unlike POJOs), this seems like one case where property-annotation would sometimes make sense.

Specifically, it'd be great to allow sort "any-getter" alternative, where entries of an ObjectNode were written as if they were the properties to include without wrapper. Something like, say,

public class Root {
   @JsonUnwrapped
   public ObjectNode values; // having values of: { "a" : 1, "b" : 3 }
}

would get serialized as

{"a":1,"b":3}

instead of what happens currently

{  "values":{"a":1, "b":3}}

NOTE: this issue is specifically for allowing serialization -- supporting deserialization side would have separate challenges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions