title: Custom serializer for serializing a List<User> in List<String>
body: <p>I've a Model object Group </p>
  
  <pre><code>public class Group {
      String title;
      List&lt;User&gt; members;
      String createdBy;
  }
  </code></pre>
  
  <p>I'm using Jackson to serialize this Object. Instead of serializing the whole User object in list "members" I want to serializer just the <code>user.getTitle()</code> field.
  Basically I want a HashMap to be something like </p>
  
  <pre><code>{
    "title" : "sometitle"
    "members" : [user1.getTitle(), user2.getTitle()]
  }
  </code></pre>
  
  <p>I've written a custom serializer for this</p>
  
  <pre><code>public class GroupSerializer extends JsonSerializer&lt;Circle&gt; {
  
      @Override
      public void serialize(Group value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
  
          if(value != null) {
              gen.writeStartObject();
              gen.writeStringField("title", value.getTitle());
              gen.writeStringField("createdBy", value.getCreatedBy());
              gen.writeFieldName("members");
              gen.writeStartArray();
              for(User user : value.getMembers()) {
                  gen.writeString(user.getEmail());
              }
              gen.writeEndArray();
              gen.writeEndObject()
          }
     }
  }
  </code></pre>
  
  <p>But it's not working. How do I serialize only a field of List instead of whole User Object?</p>