vgrabovets
9/27/2017 - 8:17 AM

dump/load gzip json

dump load json gzip

import gzip
import json

with gzip.open('path', mode='wt', encoding='utf-8') as fp:
    json.dump(data, fp)
    
with gzip.open('path', mode='rt', encoding='utf-8') as fp:
    test = json.load(fp)