title: Deserialize Avro to Map
body: <p>Does anybody know the way to deserialize <em>Avro</em> <strong>without</strong> using any <em>Pojo</em> and <em>Schemas</em>?</p>
  <p>The problem:
  I have a data stream of different Avro files.
  The goal is to group that data depending on the presence of some attributes (e.g. <code>user.role</code>, <code>another.really.deep.attribute.with.specific.value</code> and so on).
  Each avro entry might contain any number of matching attributes - from zero to all listed).</p>
  <p>So, there is no need to do anything with data. Just to peek at some elements.</p>
  <p>The question is, is there any way to convert that data to Map or Node? Like I can do it with JSON using Jackson or GSON.</p>
  <p>I've tried to use <code>GenericDatumReader</code>, but it requires a <em>Schema</em>. So maybe all I need is to read the schema from avro (how?).</p>
  <p>Also, I've tried to use something like this, but this approach doesn't work.</p>
  <pre><code>public Map deserialize(byte[] data) {
      DatumReader&lt;LinkedHashMap&gt; reader
       = new SpecificDatumReader&lt;&gt;(LinkedHashMap.class);
      Decoder decoder = null;
      try {
          decoder = DecoderFactory.get().binaryDecoder(data, null);
          return reader.read(null, decoder);
      } catch (IOException e) {
          logger.error(&quot;Deserialization error:&quot; + e.getMessage());
      }
  }
  </code></pre>
  <p>Since I have time to 'play' with the problem, I have created a utility class that generates schemas depending on keys. It works, but looks like a big overhead.</p>