title: Decoding a compressed file in python3
body: <p>So, I am compressing a JSON file.</p>
  
  <pre><code>import json
  import gzip
  with open('big.json','r') as fid_json:
      # get json as type dict
      json_dict = json.load(fid_json)
      # convert dict to str
      json_str = str(json_dict)
      json_bytes = bytes(json_str,'utf8')
  x = gzip.compress(json_bytes)
  </code></pre>
  
  <p>So can I decode the compressed byte file?I am trying this</p>
  
  <pre><code>json_str = x.decode('utf-8')
  </code></pre>
  
  <p>but this gives an error.</p>
  
  <pre><code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
  </code></pre>
  
  <p>I think i am doing something theoretically wrong or can i decode the compressed file?
  How can I get a compressed JSON file as i am trying to compress a JSON only? I am using python3.</p>