title: JSON Array with RequestParams in Android Asynchronous Http Client
body: <p>I have trouble to send a JSON POST Request to my server.</p>
  
  <p>My server accept a POST with application/json as type and an example would be like this:</p>
  
  <pre><code>{
    "name": "Group4",
    "users": [
       {"email": "user@example.org"},
       {"email": "user2@example.org"},
    ]
  }
  </code></pre>
  
  <p>If I send this by a REST client I get 200 OK as response, everything fine.</p>
  
  <p>My Android client uses the <em>Android Async HTTP Library</em> (<a href="http://loopj.com/android-async-http/" rel="nofollow noreferrer">http://loopj.com/android-async-http/</a>) and a documentation to the RequestParams class is here <a href="https://loopj.com/android-async-http/doc/com/loopj/android/http/RequestParams.html" rel="nofollow noreferrer">https://loopj.com/android-async-http/doc/com/loopj/android/http/RequestParams.html</a></p>
  
  <pre><code>RequestParams params = new RequestParams();
  String userName = getUserName();
  List&lt;String&gt; userList = getUserList();
  params.put("name", userName);
  JSONArray users = new JSONArray();
  for(String user : userList) {
      JSONObject obj = new JSONObject();
      try {
          obj.put("email", user);
      } catch (JSONException e) {
          // ...
      }
      users.put(obj);
  }
  params.put("users", users);
  </code></pre>
  
  <p>I thought this will create exactly a JSON like my example. I don't know if I have the possibility to get a JSON string of this RequestParams. I only can access the parameter as a String:</p>
  
  <pre><code>name=Test&amp;users=[{"email":"user@example.org"}, {"email":"user2@example.org"}]
  </code></pre>
  
  <p>My server don't even accept the request and fails directly with the error:</p>
  
  <pre><code>AttributeError: 'unicode' object has no attribute 'iteritems'
  </code></pre>
  
  <p>The problem has to be at the point where I create the RequestParams. Can someone tell me what is wrong with that? I thought I have to create an array with name "users" and then add objects in it with key-value items.</p>