#NEWLINE# def default( self , obj ) : #NEWLINE# #INDENT# if hasattr ( obj , 'json_repr' ) : #NEWLINE# #INDENT# return self . default ( obj . json_repr ( minimal = True ) ) #NEWLINE# #UNINDENT# if isinstance ( obj , datetime . datetime ) : #NEWLINE# #INDENT# return obj . isoformat ( ) #NEWLINE# #UNINDENT# if ( isinstance ( obj , collections . Iterable ) and ( not is_stringy ( obj ) ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return { k : self . default ( v ) for ( k , v ) in obj . items ( ) if ( v or ( v in ( False , 0 ) ) ) } #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return [ self . default ( e ) for e in obj if ( e or ( e in ( False , 0 ) ) ) ] #NEWLINE# #UNINDENT# #UNINDENT# return obj