title: Jackson: understand if source JSON is an array or an object
body: <p>Parsing JSON in Jackson library would require:</p>
  
  <ul>
  <li><p>for an object</p>
  
  <pre><code>MapType hashMapType = typeFactory.constructMapType(HashMap.class, String.class, Object.class);
  Map&lt;String, Object&gt; receivedMessageObject =  objectMapper.readValue(messageBody, hashMapType);
  </code></pre></li>
  <li><p>for an array  of objects</p>
  
  <pre><code>Map[] receivedMessage = objectMapper.readValue(messageBody, HashMap[].class)
  </code></pre></li>
  </ul>
  
  <p>What would be the best way to check whether I have array or object in messageBody, in order to route to the correct parsing? Is it just to directly check for array token in MessageBody? </p>