title: how to use GZIP to compress JSON data in python program?
body: <p>I have an AWS Kinesis python program - Producer to send data to my stream. But my JSON file is 5MB. I would like to compress the data using GZIP or any other best methods. My producer code is like this :</p>
  <pre><code>import boto3
  import json
  import csv
  from datetime import datetime
  import calendar
  import time
  import random
  
  
  
  # putting data to Kinesis
  
  my_stream_name='ApacItTeamTstOrderStream'
  
  kinesis_client=boto3.client('kinesis',region_name='us-east-1')
  
  
  with open('output.json', 'r') as file:
      for line in file:
          put_response=kinesis_client.put_record(
              StreamName=my_stream_name,
              Data=line,
              PartitionKey=str(random.randrange(3000)))
      
          print(put_response)
  </code></pre>
  <p>my requirement is :</p>
  <blockquote>
  <p>I need to compress this data and then pushed the compressed data to
  Kinesis after pushing this data, when we consume this, we need to
  decompress it...</p>
  </blockquote>
  <p>Since I am very new to this, can someone guide me or suggest to me what kind of programs I should add in the existing code?</p>