title: Get Specific Objects Inside An Array of Dictionaries in Objective-C
body: <p>I have an array of dictionaries and I want to get the values of the array that contains the key I'm searching.</p>
  
  <p>For example I have this array called <code>locationArray</code>:</p>
  
  <pre><code>(
      {
      id = 1,
      info = 
          {
          name = "Person1";
          address = "Chicago";
          };
      };
      id = 2,
      info = 
          {
          name = "Person2";
          address = "Chicago";
          };
      };
      id = 3,
      info = 
          {
          name = "Person3";
          address = "New York";
          };
      };
  );
  </code></pre>
  
  <p>and I want to get an array of all persons with address at Chicago. The result (<code>chicagoArray</code>)would be like this:</p>
  
  <pre><code>(
      {
      id = 1,
      info = 
          {
          name = "Person1";
          address = "Chicago";
          };
      };
      id = 2,
      info = 
          {
          name = "Person2";
          address = "Chicago";
          };
      };
  );
  </code></pre>
  
  <p>I did this loop but I don't know what to make of my resultArray:</p>
  
  <pre><code>for (id result in locationArray)
  {
       if ([[result valueForKeyPath@"info.address"] isEqualToString:@"Chicago"])
       {
           // What to do inside the resultArray?
           // NSArray *resultArray = [[NSArray alloc] initWithObjects:@""];
       }
  }
  </code></pre>
  
  <p>How can I do that? Thanks!</p>