title: Specifying the field naming policy for Jackson
body: <p>I have question related to bean to json serialziation/deserialization using Jackson. Previously I have used GSON to do that, but now I am faced with a project that already depends on Jackson and I would prefer not to introduce new dependency if I can do with what I already have at hand.</p>
  
  <p>So imagine I have a bean like:</p>
  
  <pre><code>class ExampleBean {
     private String firstField;
     private String secondField;
     // respective getters and setters
  }
  </code></pre>
  
  <p>And then Jackson serializes it to:</p>
  
  <pre><code>{
     "firstField": "&lt;first_field_value&gt;",
     "secondField": "&lt;second_field_value&gt;"
  }
  </code></pre>
  
  <p>I am using the following code to produce the above result:</p>
  
  <pre><code>ExampleBean bean;
  ...
  ObjectMapper mapper = new ObjectMapper();
  mapper.writeValue(outStream, bean);
  </code></pre>
  
  <p>However I would like (am expected) to get the following serialization:</p>
  
  <pre><code>{
     "first_field": "&lt;first_field_value&gt;",
     "second_field": "&lt;second_field_value&gt;"
  }
  </code></pre>
  
  <p>I have deliberately simplified my example, but I have big hierarchy of beans that I want to serialize and I want to specify that the serialized attributes should always be in snake_style (that is with underscores) and the corresponding bean fields should always be camelCased. Is there any way I can enforce such field /attribute naming policies and use them without annotating the corresponding attribute for every field?</p>