title: Removing duplicate JSON objects from file
body: <p>I have a json file from which I am trying to remove duplicate Json objects. Provided below is a sample of this file and my approach.</p>
  
  <pre><code>{"published": "Tue, 03 Mar 2015 11:39:11 GMT", "title": "Goat Goat"}
  {"published": "Tue, 03 Mar 2015 11:39:11 GMT", "title": "Goat Goat"}
  {"published": "Tue, 03 Mar 2015 11:24:15 GMT", "title": "Cat cat"}
  {"published": "Tue, 03 Mar 2015 11:19:29 GMT", "title": "Chicken Chicken"}
  {"published": "Tue, 03 Mar 2015 11:19:29 GMT", "title": "Chicken Chicken"}
  {"published": "Tue, 03 Mar 2015 10:50:15 GMT", "title": "Dog Dog"}
  {"published": "Tue, 03 Mar 2015 10:34:45 GMT", "title": "Cat cat"}
  </code></pre>
  
  <p>My approach was to create a script by initialising an empty list, reading each line (object) in the file to check for unique titles and writing the unique objects into a new json file. </p>
  
  <pre><code>from sys import argv
  
  script, input_file, output_file  = argv
  
  input_file = open(input_file)
  
  output_file = open(output_file, 'a')
  
  unique = []
  
  while True:
      A = input_file.readline()
      if A['title'] not in unique:
          unique.append(A['title'])
          output_file.write(A)
  </code></pre>
  
  <p>However, I'm getting the below error message: </p>
  
  <pre><code>Traceback (most recent call last):
    File "test_run.py", line 13, in &lt;module&gt;
      if A['title'] not in unique:
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <p>New to python so would appreciate any ideas. </p>