TypeError: a bytes-like object is required, not 'str' while json.dump code example Example: TypeError: a bytes-like object is required, not 'str' 'Hello World'.encode()