title: Check if an array of NSDictionary contains a NSDictionary
body: <p>In my app I've to check if in an array of <code>NSDictionary</code> there are another <code>NSDictionary</code>. In other words, I made a <strong>JSON</strong> file and I store it in <strong>Documents</strong>.<br>
   Now I'm parsing this JSON to insert a new entry, before I insert this entry in my JSON I need to check if the entry it's already stored in my file. I parsed JSON so:</p>
  
  <pre><code>// First I read the JSON file from the folder Documents
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"data.json"];
  NSString *content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
  NSData *data = [content dataUsingEncoding:NSUTF8StringEncoding];
  NSDictionary *dictContent = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
  // Json parsing
  NSMutableArray *array = [[NSMutableArray alloc]init];
  NSMutableArray *arrayOfDictData = [[NSMutableArray  alloc]init];
  if (dictContent) {
    NSDictionary *sites = [dictContent objectForKey:@"sites"];
    NSArray *site = [sites objectForKey:@"site"];
    array = [site mutableCopy];
  }
  </code></pre>
  
  <p>Then I've another <code>NSDictionary</code> (<code>dictForJson</code>) in which I inserted the data parsed from the HTML site, so now I need to check if the data in the dictionary <code>dictForJson</code> are still in the JSON file.<br>
  How I can check that?</p>
  
  <p>The dictForJson has this structure:</p>
  
  <pre><code>dictForJson = @{@"name": htmlTitle,
                      @"src": path,
                      @"expiryDate": expireDate};
  </code></pre>
  
  <p>the NSArray site has this structure:</p>
  
  <pre><code>site: (
          {
          expiryDate = "29 Ago 2013";
          name = Sito4;
          src = "/Users/redoddity/Library/Application Support/iPhone Simulator/6.1/Applications/2D9EBE71-4365-448D-8AD2-A08749B8DBC1/Documents/Sito4.html";
      }
  )
  </code></pre>
  
  <p>Have you any idea?
  I tried with <code>[array containsObject:dictForJson]</code>, but the NSDictionary isn't ordered so when I use this method sometimes returns 0 and other times returns 1
  Maybe it's useful I build my JSON with the following code:</p>
  
  <pre><code>- (void)JsonCreateOrEdit {
      NSDictionary *dictSites = [[NSDictionary alloc]init];
  
      NSDictionary *dictSite = [[NSDictionary alloc]init];
  
      NSMutableArray *site = [[NSMutableArray alloc]init];
  
      NSDictionary *dictForJson = [[NSDictionary alloc]init];
  
      dictForJson = @{@"name": htmlTitle,
                      @"src": path,
                      @"expiryDate": expireDate};
  
      NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
      NSString *filePath = [documentsPath stringByAppendingPathComponent:@"data.json"];
      BOOL fileExist = [[NSFileManager defaultManager] fileExistsAtPath:filePath];
  
      if (!fileExist) {
          [site addObject:dictForJson];
          dictSite = @{@"site": site};
          dictSites = @{@"sites": dictSite};
          // Creo il file Json
          NSLog(@"Il file non esiste");
          SBJsonWriter *writer = [[SBJsonWriter alloc]init];
          NSString *jsonCommand = [writer stringWithObject:dictSites];
          [CreateFile createFileIn:documentsPath with:@"data.json" andData:jsonCommand]; // This is a class method I made to create the file
      else {
          // Here there are the instructions to update the file data.json
           NSLog(@"Il file esiste");
      // Leggo il file json
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"data.json"];
      NSString *content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
      NSData *data = [content dataUsingEncoding:NSUTF8StringEncoding];
      NSDictionary *dictContent = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
      // Faccio il parsing del json
      NSMutableArray *array = [[NSMutableArray alloc]init];
      NSMutableArray *arrayOfDictData = [[NSMutableArray  alloc]init];
      if (dictContent) {
          NSDictionary *sites = [dictContent objectForKey:@"sites"];
          NSArray *site = [sites objectForKey:@"site"];
          array = [site mutableCopy];
          // Here I must check if in the array site there are the same information I'm trying to insert
      }
  }
  </code></pre>