Allow use of `@JsonFormat(with=JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)` on Class
See original GitHub issue(note: follow-up from #1851)
Currently @JsonFormat
features, and specifically Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES
, does not apply if annotated via class. Like:
@JsonFormat(with={ JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES })
static class Role {
public String ID;
public String Name;
}
whereas similar setting with mapper.configOverrides(class)
does work.
It would probably make sense to allow annotation on class too, having lower precedence than config override, but higher than general one.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:9 (5 by maintainers)
Top Results From Across the Web
JsonFormat.Feature (Jackson-annotations 2.13.0 API)
ACCEPT_CASE_INSENSITIVE_PROPERTIES , which allows case-insensitive matching of property names (but NOT values, see ACCEPT_CASE_INSENSITIVE_VALUES for that).
Read more >Guide to @JsonFormat in Jackson - Baeldung
@JsonFormat is a Jackson annotation that we use to specify how to format fields and/or properties for JSON output. Specifically, this annotation ...
Read more >Jackson JSON - Using @JsonFormat to format Date and Enum
@JsonFormat is a general purpose annotation which can be used to serialize a particular type into a specific format.
Read more >Jackson Feature ACCEPT_SINGLE_VALUE_AS_ARRAY ...
You will need to use that annotation on actual property, not the POJO that contains property.
Read more >Best bits of Jackson 2.6 - cowtowncoder - Medium
These allow enabling and/or disabling various features for individual properties, ... public class POJO { @JsonFormat(with = JsonFormat.Feature.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It isn’t working for me (class or properties). If I create a custom mapper, it works.
How can I use this annotation on a property? I am using the last version of Jackson @cowtowncoder
Ah, yes,
@JsonAlias
is good to mention here.And as a sidenote: the reason for no support for single-property case-insensitivity is the technical implementation: lookup for all properties is via data structure that does either strict, or case-insensitive. So there is no way to distinguish this on per-property basis, as of yet.