title: create valid json object in python
body: <p>Each line is valid JSON, but I need the file as a whole to be valid JSON. </p>
  
  <p>I have some data which is aggregated from a web service and dumped to a file, so it's JSON-eaque, but not valid JSON, so it can't be processed in the simple and intuitive way that JSON files can - <em>thereby consituting a major pain in the neck</em>, it looks (more or less) like this: </p>
  
  <pre><code>{"record":"value0","block":"0x79"} 
  {"record":"value1","block":"0x80"} 
  </code></pre>
  
  <p>I've been trying to reinterpret it as valid JSON, my latest attempt looks like this:</p>
  
  <pre><code>with open('toy.json') as inpt:
      lines = []
      for line in inpt:
          if line.startswith('{'):  # block starts
              lines.append(line) 
  </code></pre>
  
  <p>However, as you can likely deduce by the fact that I'm posing this question- that doesn't work- any ideas about how I might tackle this problem? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Tried this: </p>
  
  <pre><code>with open('toy_two.json', 'rb') as inpt:
  
      lines = [json.loads(line) for line in inpt] 
  
  print(lines['record'])
  </code></pre>
  
  <p>but got the following error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "json-ifier.py", line 38, in &lt;module&gt;
      print(lines['record'])
  TypeError: list indices must be integers, not str
  </code></pre>
  
  <p>Ideally I'd like to interact with it as I can with normal JSON, i.e. <code>data['value']</code></p>
  
  <p><strong>EDIT II</strong></p>
  
  <pre><code>with open('transactions000000000029.json', 'rb') as inpt:
  
      lines = [json.loads(line) for line in inpt]
  
      for line in lines: 
          records = [item['hash'] for item in lines]
      for item in records: 
          print item
  </code></pre>