How to make json.dumps in Python ignore a non-serializable field
问题 I am trying to serialize the output of parsing some binary data with the Construct2.9 library. I want to serialize the result to JSON. packet is an instance of a Construct class Container . Apparently it contains a hidden _io of type BytesIO - see output of dict(packet) below: { 'packet_length': 76, 'uart_sent_time': 1, 'frame_number': 42958, 'subframe_number': 0, 'checksum': 33157, '_io': <_io.BytesIO object at 0x7f81c3153728>, 'platform':661058, 'sync': 506660481457717506, 'frame_margin':