title: Extra data: line 2 column 1 (char 876): JSONDecodeError
body: <p>I'm trying to read json from a text file. I can convert the text file to json but some times it throws this error for some json data. <code>Extra data: line 2 column 1 (char 876): JSONDecodeError</code>.</p>
  
  <p>Here is the error stacktrace.</p>
  
  <pre><code>Extra data: line 2 column 1 (char 876): JSONDecodeError
  Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 28, in lambda_handler
  d = json.loads(got_text)
  File "/var/lang/lib/python3.6/json/__init__.py", line 354, in loads
  return _default_decoder.decode(s)
  File "/var/lang/lib/python3.6/json/decoder.py", line 342, in decode
  raise JSONDecodeError("Extra data", s, end)
  json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 876)
  </code></pre>
  
  <p>Here is the code.</p>
  
  <pre><code>    retr = s3_client.get_object(Bucket=bucket, Key=key)
      bytestream = BytesIO(retr['Body'].read())
      got_text = GzipFile(mode='rb', fileobj=bytestream).read().decode('utf-8')
      print(got_text)
      d = json.loads(got_text)
      print("json output")
      print(d)
  </code></pre>
  
  <p>Here is the json.</p>
  
  <pre><code>{
      "_metadata": {
          "bundled": [
              "Segment.io"
          ],
          "unbundled": []
      },
      "anonymousId": "98cc0c53-jkhjkhj-42d5-8ee1-08a6d6f4e774",
      "context": {
          "library": {
              "name": "analytics.js",
              "version": "3.2.5"
          },
          "page": {
              "path": "/login",
              "referrer": "http://localhost:8000/",
              "search": "",
              "title": "Sign in or Register | Your Platform Name Here",
              "url": "http://localhost:8000/login"
          },
          "userAgent": "Mozilla/5.0 ",
          "ip": "67.67.88.68"
      },
      "integrations": {},
      "messageId": "ajs-dfbdfbdfbdb",
      "properties": {
          "path": "/login",
          "referrer": "http://localhost:8000/",
          "search": "",
          "title": "Sign in or Register | Your Platform Name Here",
          "url": "http://localhost:8000/login"
      },
      "receivedAt": "2018-02-05T09:21:02.539Z",
      "sentAt": "2018-02-05T09:21:02.413Z",
      "timestamp": "2018-02-05T09:21:02.535Z",
      "type": "page",
      "userId": "16",
      "channel": "client",
      "originalTimestamp": "2018-02-05T09:21:02.409Z",
      "projectId": "dfbfbdfb",
      "version": 2
  }
  </code></pre>
  
  <p>What could be the problem?</p>