code: def write_json(obj, path):
      
      obj_str = text_type(json.dumps(obj, indent=4, separators=(",", ": "),
                                     ensure_ascii=False))
  
      helpers.ensure_dir_exists(os.path.dirname(path))
  
      with io.open(path, "w", encoding='utf-8') as target:
          target.write(obj_str)
docs: Escribo un objeto a un archivo JSON con codificación UTF-8.