code: def json_unicode_to_utf8(data):
      
      if isinstance(data, unicode):
          return data.encode('utf-8')
      elif isinstance(data, dict):
          newdict = {}
          for key in data:
              newdict[json_unicode_to_utf8(
                  key)] = json_unicode_to_utf8(data[key])
          return newdict
      elif isinstance(data, list):
          return [json_unicode_to_utf8(elem) for elem in data]
      else:
          return data
docs: Change all strings in a JSON structure to UTF-8.