Get_annotations( ) for YOLO format dataset?

For Object detection custom dataset which is in YOLO format, will get_annotations() method be used to get bbox coordinates and labels?? (or only for json format)
For creating custom dataset for realtime obj detection, which format is preferred Json or Yolo???