def save_json(filename, data):
 mode = u'w'
 if (sys.version_info[0] < 3):
  mode = u'wb'
 with open(filename, mode) as fp:
  json.dump(data, fp, sort_keys=True, indent=4)

def save_json ( filename , data ) : mode = u'w' if ( sys . version_info [ 0 ] < 3 ) : mode = u'wb' with open ( filename , mode ) as fp : json . dump ( data , fp , sort_keys = True , indent = 4 )
save data to a json file parameters filename : str filename to save data in .