title: Jackson deserialize Enums with multiple names
body: <p>I have problems deserializing Enums that have multiple names for a value. Here is an example: Info is a Java class that inside has an enum with multiple names:</p>
  
  <pre><code>public class Info {
      //...
      private ContainerFormat format;
  }
  
  // ContainerFormat.java:
  
  public enum ContainerFormat {
      //  ....
      MP4("mp4", "mpeg4"),
      UNKNOWN("null");
  
      private String name;
      private List&lt;String&gt; others;
  
      ContainerFormat(String name) {
          this.name = name;
      }
  
      /** The service does not always return the same String for output formats.
       * This 'other' string fixes the deserialization issues caused by that.
       */
      ContainerFormat(String name, String... others) {
          this.name = name;
          this.others = new ArrayList&lt;String&gt;();
          for (String other : others) {
              this.others.add(other);
          }
      }
  
      @JsonValue
      @Override
      public String toString() {
          return name;
      }
  
      public List&lt;String&gt; otherNames() {
          return others;
      }
  
      @JsonCreator
      public static ContainerFormat fromValue(String other) throws JsonMappingException {
          for (ContainerFormat format : ContainerFormat.values()) {
              if (format.toString().equalsIgnoreCase(other)) {
                  return format;
              }
              if (format.otherNames() != null &amp;&amp; format.otherNames().contains(other)) {
                  return format;
              }
          }
          return UNKNOWN;
      }
  }
  </code></pre>
  
  <p>The problem is when I deserialize something that contains "mpeg4" instead of mp4 I get this error:</p>
  
  <pre><code>com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of com.foo.ContainerFormat from String value 'mpeg4': value not one of declared Enum instance names
   at [Source: N/A; line: -1, column: -1] (through reference chain: com.foo.Info["format"])
      at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:55)
      at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:650)
      at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:85)
      at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:20)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:375)
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:98)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:308)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
      at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:2769)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1478)
      at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:1811)
  </code></pre>
  
  <p>Any pointers on how to fix this?</p>
  
  <p>TIA</p>