class_docstr: TextStats contains following basic information:
docstr: Map stats information into a json object
  
  Returns:
      A json that represent frequency count and total count
docstr_tok: ["Map","stats","information","into","a","json","object","Returns",":","A","json","that","represent","frequency","count","and","total","count"]
code: def to_json(self) -> Dict:
      """
      Map stats information into a json object
  
      Returns:
          A json that represent frequency count and total count
      """
  
      json_obj = dict()
      json_obj[STATSKEY.TOTAL_COUNT] = self._total_count
      json_obj[STATSKEY.PATTERN] = []
      for pattern_name in self._pattern_stats.keys():
          pattern_obj = dict()
          pattern_obj[STATSKEY.PATTERN.PATTERN_NAME] = pattern_name
          pattern_obj[
              STATSKEY.PATTERN.PATTERN_TF
          ] = self._pattern_stats[pattern_name][0]
          pattern_obj[
              STATSKEY.PATTERN.PATTERN_DF
          ] = self._pattern_stats[pattern_name][1]
          json_obj[STATSKEY.PATTERN].append(pattern_obj)
  
      json_obj[STATSKEY.TF] = self._term_frequency
      json_obj[STATSKEY.DF] = self._document_frequency
      json_obj[STATSKEY.TFIDF] = self._tfidf
  
      return json_obj
  
imports: from typing import Dict, Optional, Tuple
  from xai.data.abstract_stats import AbstractStats
  from xai.data.constants import STATSKEY
  from xai.data.exceptions import InvalidTypeError, InvalidSizeError
label_desc: Use image node_id 16 for calling the TextStats obj's underlying member method code with example usage: obj.to_json() and returns: json_obj