title: Avro Map Serialization/Deserialization issue
body: <p>Currently I am using <strong>Avro 1.8.0</strong> to serialize / deserialize objects but facing issue especially for java.util.Map object. Not facing issue with other type of objects.</p>
  
  <p>Sample code here -</p>
  
  <pre><code>class AvroUtils {
  
      public byte[] serialize(Object payload) {
          final ByteArrayOutputStream out = new ByteArrayOutputStream();
          Schema schema = new ReflectDatumWriter().getData().induce(payload); //---&gt; getting proper map schema as {"type":"map","values":"string"}
          JsonEncoder jsonEncoder = EncoderFactory.get().jsonEncoder(schema, out);
          final GenericDatumWriter&lt;Object&gt; writer = new GenericDatumWriter(schema);
          writer.write(payload, jsonEncoder);
          jsonEncoder.flush();
          return out.toByteArray();
      }
  
      public &lt;R&gt; R deserialize(Object o, Class&lt;R&gt; aClass) {
          Schema schema = new ReflectDatumWriter().getData().induce(o); //------&gt; getting error - unable to get schema
          final ByteArrayInputStream bin = new ByteArrayInputStream((byte[]) o);
          JsonDecoder jsonDecoder = DecoderFactory.get().jsonDecoder(schema, bin);
          final GenericDatumReader&lt;R&gt; reader = new GenericDatumReader&lt;&gt;(schema);
          return reader.read(null, jsonDecoder);
      }
  
      public static void main(String[] args) {
          Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
          map.put("Key1", "Value1");
          map.put("Key2", "Value2");
  
          // Serialization
          byte[] result = this.serialize(map);
          System.out.println("Serialized Data : " + new String(mapDes, "UTF-8"));
  
          // Deserialization
          Map&lt;String, Object&gt; mapDes = (Map&lt;String, Object&gt;) this.deserialize(result, Map.class);
          System.out.println("Deserialized Data : " + mapDes);
      }
  }
  </code></pre>
  
  <p>In deserialize method I am trying to get the schema based on input data but avro is throwing error -</p>
  
  <pre><code>`Exception in thread "main" java.lang.ClassCastException: [B cannot be cast to java.util.Collection
  at org.apache.avro.reflect.ReflectData.getArrayAsCollection(ReflectData.java:196)
  at org.apache.avro.generic.GenericData.induce(GenericData.java:612)`
  </code></pre>
  
  <p>Note: At the end both the methods will be placed in different libraries (avro-serializer / avro-deserializer).</p>
  
  <p>Please suggest the best way to get schema in deserialization method.</p>
  
  <p>Thanks.</p>