title: How to compare two JSON files in python 2.7?
body: <p>I have two files filled with JSON objects. One is converted from XML using the Python module <code>xmltodict</code>. Once I have all the XML as dicts I convert them to JSON objects by using <code>json.dumps</code>. In the other file I have a bunch of JSON objects from an HTTP GET request. My goal is to compare the first file to the second file and if the first file has a JSON object where the <code>name</code> key doesn't match any of the objects <code>name</code> keys in the second file then it gets added to the second file. My question is does anyone have a suggestion how to do this? Or will I just have to resort to cold hard parsing? The psuedocode below is how I currently think to accomplish this:</p>
  
  <pre><code>postFlag = 0
  for obj1 in file1:                      #for each JSON object in first file
      for obj2 in file2:                  #compare to each JSON object in second file.
          if obj1.name == obj2.name:      #if they match,
              postFlag = 0                #prepare to not post
              break                       #and go to next JSON object in file1
          else:                           #if they dont match
              postFlag = 1                #prepare to post
      if postFlag == 1:                   #if went through all obj2 and no match, then add to file2
          add obj1 to file2
  </code></pre>