question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
JavierSegoviaCordobacommented, Jul 26, 2018

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

1reaction
cowtowncodercommented, Nov 23, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found