#NEWLINE# def json_without_bytes( jobj ) : #NEWLINE# #INDENT# '\n        An ugly hack.\n\n        Before we treat a structure as JSON, ensure that bytes are decoded to str.\n    ' #NEWLINE# jobj = jobj . copy ( ) #NEWLINE# for ( k , v ) in jobj . items ( ) : #NEWLINE# #INDENT# if isinstance ( v , six . binary_type ) : #NEWLINE# #INDENT# jobj [ k ] = v . decode ( 'utf8' , 'replace' ) #NEWLINE# #UNINDENT# #UNINDENT# return jobj