Skip to content

Presence of PropertyNamingStrategy Makes Deserialization Fail #815

@gilbode

Description

@gilbode

I originally came across this issue using Dropwizard - dropwizard/dropwizard#1095. But it looks like this is a Jackson issue. Here's the rerproducer:

public class TestPropertyNamingStrategyIssue {
  public static class ClassWithObjectNodeField {
    public String id;
    public ObjectNode json;
  }

  @Test
  public void reproducer() throws Exception {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE);
    ClassWithObjectNodeField deserialized =
        mapper.readValue(
            "{ \"id\": \"1\", \"json\": { \"foo\": \"bar\", \"baz\": \"bing\" } }",
            ClassWithObjectNodeField.class);
  }
}

Looks like the presence of any PropertyNamingStrategy make deserialization to ObjectNode fail. This works fine if I remove the property naming strategy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions