title: Use JSONKit and AFNetworking to make url query a complex JSON object
body: <p>I am using AFNetworking to perform login and the url format is like this:</p>
  
  <pre><code>http://xxx/mobile?function=login&amp;req={username:xxx,password:xxx}
  </code></pre>
  
  <p>So firstly I created the parameters using a NSDictionary within a NSDictionary, like below:</p>
  
  <pre><code>@{@"function" : @"login",
    @"req" : @{@"username" : @"xxx", @"password" : @"xxx"}}
  </code></pre>
  
  <p>But the query comes out is wrong</p>
  
  <pre><code>function=login&amp;req[password]=xxx&amp;req[username]=xxx
  </code></pre>
  
  <p>After this, I used <a href="https://github.com/johnezang/JSONKit" rel="nofollow">JSONKit</a> to package the parameter</p>
  
  <pre><code>NSDictionary *userInfo = @{@"userName" : [username URLEncodedString],
                             @"password" : [password URLEncodedString]};
  
  NSDictionary *parameters = @{@"function" : @"login",
                             @"req" : [userInfo JSONString]};
  </code></pre>
  
  <p>And the results seem alike but "{}" encoded</p>
  
  <pre><code>function=login&amp;req=%7B%22userName%22%3A%22xxx%22%2C%22password%22%3A%22xxx%22%7D
  </code></pre>
  
  <p>Where did I goes wrong? How can I correct it?
  Many Thanks!</p>