title: How to get XStream to map back to a typed List?
body: <p>I'm using XStream to map some JSON back into Java objects. I'll be dealing with a JSON string that might look like this:</p>
  
  <pre><code>{
      "widgets":[
      {
          "widget_name": "Kenny",
          "widget_type": "Character"
      },
          "widget_name": "Apple",
          "widget_type": "Fruit"
      }
      ]
  }
  </code></pre>
  
  <p><strong>Update:</strong> I <em>believe</em> this JSON could be interpreted as:</p>
  
  <blockquote>
    <p>This JSON represents an un-named object that contains a <code>widgets</code> object. The <code>widgets</code> object, in turn, contains an array of other un-named objects. Each of these un-named objects contain two properties: <code>widget_name</code> and <code>widget_type</code>.</p>
  </blockquote>
  
  <p>Each <code>Widget</code> in this <code>widgetlist</code> corresponds to a POJO:</p>
  
  <pre><code>public class Widget {
      private String name;
      private String type;
  
      // ...etc.
  }
  </code></pre>
  
  <p>I'd like the above JSON string to map back to a <code>List&lt;Widget&gt;</code>, but I can't seem to figure out how to alias the class correctly:</p>
  
  <pre><code>XStream xs = new XStream();
  xs.alias("widgetlist", List.class); // Not a List&lt;Widget&gt; !
  </code></pre>
  
  <p><strong>How can I get the <code>xs</code> mapper to translate <code>widgetlist</code> into a <code>List&lt;Widget&gt;</code>?</strong> Thanks in advance.</p>