title: Converting Object to Map: Cast vs ObjectMapper
body: <p>What is the difference between below two methods of converting <code>Object</code> to <code>Map</code>? And which method is better, assuming both methods work for converting an <code>Object</code> to a <code>Map</code>? </p>
  
  <p>Cast:</p>
  
  <pre><code>Object o = some object;
  Map&lt;String, Object&gt; map = (Map&lt;String, Object&gt;) o;
  </code></pre>
  
  <p>ObjectMapper:</p>
  
  <pre><code>Object o = some object;
  Map&lt;String, Object&gt; map = new ObjectMapper().readValue((String) o, new TypeReference&lt;Map&lt;String, Object&gt;&gt;() {});
  </code></pre>