So, I want to compress my JSON data using different compressor. I used this to compress the JSON.
import gzip
import JSON
with gzip.GzipFile('2.json', 'r') as isfile:
for line in isfile:
obj = json.loads(line)
which raises error.
raise OSError('Not a gzipped file (%r)' % magic)
OSError: Not a gzipped file (b'[\n')
I also tried direct compressing using.
zlib_data= zlib.compress(data)
which raises an error.
return lz4.block.compress(*args, **kwargs)
TypeError: a bytes-like object is required, not 'list'
So, Basically i want to compress a JSON using all the methods and to compute the time taken for the compression in different methods.