How can I enable Pascal casing by default when using Jackson JSON in Spring MVC?
Posted
by
bhilstrom
on Stack Overflow
See other posts from Stack Overflow
or by bhilstrom
Published on 2011-01-12T14:51:01Z
Indexed on
2011/01/12
14:54 UTC
Read the original article
Hit count: 402
I have a project that uses Spring MVC to create and handle multiple REST endpoints. I'm currently working on using Jackson to automatically handle the seralization/deserialization of JSON using the @RequestBody and @ResponseBody annotations.
I have gotten Jackson working, so I've got a starting point. My problem is that our old serialization was done manually and used Pascal casing instead of Camel casing ("MyVariable" instead of "myVariable"), and Jackson does Camel casing by default.
I know that I can manually change the name for a variable using @JsonProperty. That being said, I do not consider adding "@JsonProperty" to all of my variables to be a viable long-term solution.
Is there a way to make Jackson use Pascal casing when serializing and deserializing other than using the @JsonProperty annotation?
© Stack Overflow or respective owner