title: groovy: LazyMap class cast exception
body: <p>I have a code to parse a huge JSON:</p>
  
  <pre><code>static &lt;T&gt; List&lt;T&gt; parseJSON(String json) {
     Map&lt;String, T&gt; result = jsonSlurper.parseText(json)
     List&lt;T&gt; list = result.result
     return list
  }
  </code></pre>
  
  <p>the String json = {result:[{obj1},{obj2}....]}</p>
  
  <p>I am getting a proper List at the end with the variable list but in Java when I get the value it throws an exception <code>java.lang.ClassCastException: groovy.json.internal.LazyMap cannot be cast to {MyPOJO}</code></p>
  
  <p>here is how I receive the data</p>
  
  <pre><code>List&lt;MYClass&gt; list = MyClass.parseJSON(someString);
  for(MyClass i : list) {
    System.out.println(i.someValue());
  }
  </code></pre>
  
  <p>how can I resolve this?</p>