class_docstr: A set of QA predictions for a passage or a document. The candidates are stored in QAPred.prediction which is a
  list of QACandidate objects. Also contains all attributes needed to convert the object into json format and also
  to create a context window for a UI
docstr: Convert all answers into a json format
  
  :param id: ID of the question document pair
  :param squad: If True, no_answers are represented by the empty string instead of "no_answer"
  :return:
docstr_tok: ["Convert","all","answers","into","a","json","format",":","param","id",":","ID","of","the","question","document","pair",":","param","squad",":","If","True",",","no_answers","are","represented","by","the","empty","string","instead","of","``","no_answer","''",":","return",":"]
code: def _answers_to_json(self, ext_id, squad=False):
      """
      Convert all answers into a json format
  
      :param id: ID of the question document pair
      :param squad: If True, no_answers are represented by the empty string instead of "no_answer"
      :return:
      """
  
      ret = []
  
      # iterate over the top_n predictions of the one document
      for qa_candidate in self.prediction:
          if squad and qa_candidate.answer == "no_answer":
              answer_string = ""
          else:
              answer_string = qa_candidate.answer
          curr = {
              "score": qa_candidate.score,
              "probability": None,
              "answer": answer_string,
              "offset_answer_start": qa_candidate.offset_answer_start,
              "offset_answer_end": qa_candidate.offset_answer_end,
              "context": qa_candidate.context_window,
              "offset_context_start": qa_candidate.offset_context_window_start,
              "offset_context_end": qa_candidate.offset_context_window_end,
              "document_id": ext_id,
          }
          ret.append(curr)
      return ret
  
imports: from typing import List, Any
  from abc import ABC
  import logging
label_desc: Use image node_id 3 for calling the QAPred obj's underlying member method code with example usage: obj._answers_to_json(ext_id, squad) and returns: ret