Skip to content

Instantly share code, notes, and snippets.

@danielnorberg
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielnorberg/088cf109a65828f678eb to your computer and use it in GitHub Desktop.
Save danielnorberg/088cf109a65828f678eb to your computer and use it in GitHub Desktop.
Foobar foobar = new FoobarBuilder()
.someFooThing(17)
.aBarField("hello world")
.build();
String json = mapper.writeValueAsString(foobar);
out.println(json);
{
"some_foo_thing": 17,
"a_bar_field": "hello world"
}
ObjectMapper mapper = new ObjectMapper()
.registerModule(new AutoMatterModule(CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES));
@AutoMatter(json = LOWER_CASE_WITH_UNDERSCORES)
public interface Foobar {
int someFooThing();
String aBarField();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment