I'm dealing with JSON whose property names are snake-cased, but, I need these transformed into a lower camel case.
I don't have beans for all the corresponding objects so the usual ser-de tricks of Jackson don't apply (I think).
I tried reading it into a Map and setting a global property naming strategy but that didn't work.
String json = "{\"first_name\": \"John\", \"last_name\": \"Doe\" }";
Map<?, ?> myMap = new ObjectMapper().readValue(json, Map.class);
System.out.println(new ObjectMapper()
.setPropertyNamingStrategy(new UpperCamelCaseStrategy())
.writerWithDefaultPrettyPrinter()
.writeValueAsString(myMap));
I don't need this to be necessarily accomplished in Jackson. While a simple problem, it did leave me quite lost as to what a sane way of accomplishing this might be.