def json_dump(data, filename):
 with open(filename, u'w') as fh:
  json.dump(data, fh, cls=JSONEncoder, indent=2)

def json_dump ( data , filename ) : with open ( filename , u'w' ) as fh : json . dump ( data , fh , cls = JSONEncoder , indent = 2 )
dumps a data structure as json in the named file .