Accept both JSON strings and Python objects as data in Python API function set_data.