title: Python sort a json based on a key inside an array of dictionary
body: <p>I have a structure like this:</p>
  
  <pre><code>[{
      "name": "apple",
      "price": "5.0",
      "record": [
          {
              "id": "008",
              "time": 1465689600
          }
      ] 
  },{
      "name": "banana",
      "price": "9.0",
      "record": [
          {
              "id": "002",
              "time": 1465682600
          }
      ]
  }]
  </code></pre>
  
  <p>I tried below but it gave me an error: string indices must be integers.</p>
  
  <pre><code>sorted(lines, key=lambda k: k['record'].get('time', 0),reverse=True)
  </code></pre>
  
  <p>How do I sort the above based on the "time" value?</p>
  
  <p>Thanks.</p>