title: JSONObject cannot be converted to JSONArray
body: <p>My Android application is expecting and array of usernames from my WCF Service using the following Java, to then populate a spinner.</p>
  
  <pre><code>JSONArray mtUsers = new JSONArray(new String(buffer));
  </code></pre>
  
  <p>But it seems to be getting a JSONObject as I get the following error,</p>
  
  <pre><code>Android JSONObject cannot be converted to JSONArray
  </code></pre>
  
  <p>The JSON that’s returned looks like this,</p>
  
  <pre><code>{"GetUserNamesResult":[{"UserName":"Peyton"},{"UserName":"Drew"},{"UserName":"Brett"}]}
  </code></pre>
  
  <p>This is the code in my service,</p>
  
  <p>Interface:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "GET",
      ResponseFormat = WebMessageFormat.Json,
      BodyStyle = WebMessageBodyStyle.Wrapped,
      UriTemplate = "GetUserNames")]
  IList&lt;UserNames&gt; GetUserNames();
  </code></pre>
  
  <p>And class:</p>
  
  <pre><code>public IList&lt;UserNames&gt; GetUserNames()
  {
      IList&lt;UserNames&gt; lstusernames = new List&lt;UserNames&gt;();
      var usernames = from p in _db.Users
              select p;
      foreach (User singleUsernames in usernames)
      {
          UserNames a = new UserNames();
          a.UserName = singleUsernames.UserName;
  
          lstusernames.Add(a);
      }
      return lstusernames;
  }
  </code></pre>
  
  <p>What should the JSON look like and can anyone see what I’m doing wrong??? </p>
  
  <p>Instead of stumbling around in the dark trying to return a string or string[], I thought I would ask you guys and gals.</p>
  
  <p>Cheers,</p>
  
  <p>Mike.</p>