title: Swift: Create Dictionary from Inner Items of JSON Array
body: <p>In Swift, I have a POST request to a URL which returns JSON similar to this:</p>
  
  <pre><code>{"users":[{
  "user":{"userID":"1","userName":"John"}},
  {"user":{"userID":"2","userName":"Mary"}},
  {"user":{"userID":"3","userName":"Steve"}},
  ]}
  </code></pre>
  
  <p>Here's the Swift code:</p>
  
  <pre><code>var result = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.allZeros, error: nil) as? NSDictionary
  println(result?.count)
  println(result)
  </code></pre>
  
  <p>...Which outputs this:</p>
  
  <pre><code>Optional(1)
  Optional({
      users = ({
          user = {
                  userID = 1;
                  userName = John;
              };
          },
              {
          user = {
                  userID = 2;
                  userName = Mary;
              };
          },
              {
          user = {
              userID = 3;
              userName = "Steve";
          };
      });
  })
  </code></pre>
  
  <p>I'm trying to loop through the "user" elements but nothing I try is working. I have a dictionary of the "user" level JSON, but don't know how to go on to get the child "users" of this. Does anyone know how I can do this? If I could look through them to println() the users' names that would be a great start.</p>