Describe your Issue
Currently @JsonPropertyOrder can only be used with regular (or "true") properties, and it will have no effect on:
- "any properties" specified with
@JsonAnyGetter
- "unwrapped properties" that result from
@JsonUnwrapped
It would be good to improve so that at least groups could be ordered, so that f.ex following:
@JsonPropertyOrder({ "id", "unwrapped", "name", "any" })
public class POJO {
public int id;
public String name;
@JsonAnyGetter
protected Map<String, Object> any;
@JsonUnwrapped
protected Values unwrapped;
}
would sort output properties as expected, so unwrapped properties of Values unwrapped would be after id but before name, and "any properties" from Map<> any would be serialized after everything else.
No ordering would be imposed based within "any" or "unwrapped" properties (although @JsonPropertyOrder(alphabetic = true) could be taken into account as well; this would be #518.
Describe your Issue
Currently
@JsonPropertyOrdercan only be used with regular (or "true") properties, and it will have no effect on:@JsonAnyGetter@JsonUnwrappedIt would be good to improve so that at least groups could be ordered, so that f.ex following:
would sort output properties as expected, so unwrapped properties of
Values unwrappedwould be afteridbut beforename, and "any properties" fromMap<> anywould be serialized after everything else.No ordering would be imposed based within "any" or "unwrapped" properties (although
@JsonPropertyOrder(alphabetic = true)could be taken into account as well; this would be #518.