class CustomLastUpdatedUserSerializer extends JsonSerializer<User> {

    @Override
    public void serialize( User user, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws  IOException
    {
        ToXmlGenerator xmlGenerator = null;
        if ( jsonGenerator instanceof ToXmlGenerator )
        {
            xmlGenerator = (ToXmlGenerator) jsonGenerator;
        }

        jsonGenerator.writeStartObject();
        if ( xmlGenerator != null )
        {
            xmlGenerator.setNextIsAttribute( true );
            xmlGenerator.setNextName( null );
        }
        jsonGenerator.writeStringField( "id", user.getUid() );
        jsonGenerator.writeStringField( "name", user.getDisplayName() );
        jsonGenerator.writeEndObject();
    }

}