#NEWLINE# def write_json( self , filename ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'root' : self . root , #NEWLINE# 'tags' : self . tags , #NEWLINE# 'speakers' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# for ( speaker , info , records ) in zip ( self . spkrs , self . spkrs_info , self . records ) : #NEWLINE# #INDENT# speaker_records = [ r . to_dict ( ) for r in records ] #NEWLINE# data [ 'speakers' ] . append ( { #NEWLINE# #INDENT# 'name' : speaker , #NEWLINE# 'info' : filename , #NEWLINE# 'records' : speaker_records , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# with open ( filename , 'w' ) as f : #NEWLINE# #INDENT# json . dump ( data , f , indent = 2 )