docstr: Write the fold split to the `filepath` as json.
  
  format is for 3 folds:
  {
      "folds": [
          [file1, file4, file7, ...],
          [file2, file5, file8, ...],
          [file3, file6, file9, ...]
      ]
      "type": FILE (or HDF5)
  }
docstr_tok: ["Write","the","fold","split","to","the","`","filepath","`","as","json",".","format","is","for","3","folds",":","{","``","folds","''",":","[","[","file1",",","file4",",","file7",",","...","]",",","[","file2",",","file5",",","file8",",","...","]",",","[","file3",",","file6",",","file9",",","...","]","]","``","type","''",":","FILE","(","or","HDF5",")","}"]
code: def write_folds_to_json(self, filepath: str):
      """Write the fold split to the `filepath` as json.
  
      format is for 3 folds:
      {
          "folds": [
              [file1, file4, file7, ...],
              [file2, file5, file8, ...],
              [file3, file6, file9, ...]
          ]
          "type": FILE (or HDF5)
      }
      """
      with open(filepath, "w") as f:
          json.dump(
              {
                  "isH5": self.is_h5_dataset,
                  "folds": self.folds,
              },
              f,
              indent=4,
          )
  
file_path: calamari/calamari_ocr/ocr/training/cross_fold.py
imports: import os
  import json
  from contextlib import ExitStack
  from typing import List, Optional
  from tfaip.data.pipeline.definitions import Sample, PipelineMode
  from tfaip.util.multiprocessing.parallelmap import tqdm_wrapper
  from calamari_ocr.ocr.dataset.datareader.base import CalamariDataGeneratorParams
  from calamari_ocr.ocr.dataset.datareader.file import FileDataGenerator, FileDataParams
  from calamari_ocr.ocr.dataset.datareader.hdf5 import Hdf5DatasetWriter
label_desc: Use image node_id 7 for calling the CrossFold obj's underlying member method code with example usage: obj.write_folds_to_json(filepath) without return types