title: Fallback Class<?> for mapper.readValue
body: <p>I am using Jackson for de/serialization in my app. </p>
  
  <p>I have a situation where I need to convert a JSON string to one of my 3 classes. In case the string can't be converted to either one of 3 classes, it will considered to be an unrecognized case.</p>
  
  <p>However, if the schema of json string and the provided class in <code>mapper.readValue(jsonString,MyClass1.class)</code> does not match, it throws an <code>UnrecognizedPropertyException</code>.</p>
  
  <p>Currently I am using something like below, but it seems to be pretty messy.</p>
  
  <pre><code>try {
      obj = mapper.readValue(jsonString, MyClass1.class);             
  } catch (UnrecognizedPropertyException e1) {
      try {
          obj = mapper.readValue(jsonString, MyClass2.class);
      } catch (UnrecognizedPropertyException e2) {
          try {
              obj = mapper.readValue(jsonString, MyClass3.class);
          } catch (Exception e) {
              //handle unrecognized string
          }
      } catch (Exception e) {
          //handle unrecognized string
      }
  } catch (Exception e) {
      //handle unrecognized string
  }
  </code></pre>
  
  <p>Is this how it needs to be done or is there any other alternative? Is there any way to configure the <code>mapper</code> to return <code>null</code> in case of unrecognized properties, as that would result in creating a simple series <code>if</code> blocks instead of nested <code>try-catch</code> blocks?</p>