Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PascalCaseStrategy ignores @JsonProperty on method #428

Closed
piotrturski opened this issue Mar 26, 2014 · 1 comment
Closed

PascalCaseStrategy ignores @JsonProperty on method #428

piotrturski opened this issue Mar 26, 2014 · 1 comment
Milestone

Comments

@piotrturski
Copy link

naming strategy changes name provided in JSONPropertyAnnotation

copied from: http://stackoverflow.com/questions/22667964/jackson-pascal-case-and-jsonproperty-on-getter

the following test should pass but it fails

import static org.assertj.core.api.Assertions.assertThat;
import org.testng.annotations.Test;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;

public class JsonFailureTest {

    @Test
    public void should_serialize_first_letter_lowercase() throws Exception {

        String json = new ObjectMapper()
                            .setPropertyNamingStrategy(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE)
                            .writeValueAsString(

        new Object(){

            @JsonProperty("fooBar")
            public String whatever() {return "";}

        });

        assertThat(json).contains("fooBar");
    }
}
@cowtowncoder cowtowncoder added this to the 2.4.0 milestone Mar 28, 2014
@cowtowncoder
Copy link
Member

Fixed, but underlying changes are such that this can only go in 2.4.0 (too risky for 2.3.x patches).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants