class_docstr: CategoricalStats contains following basic information:
      - _total_count: total count of values
      - _frequency_count: a dictionary maps categorical value to its frequency count
docstr: Map stats information into a json object
  
  Returns:
      A json that represents frequency count and total count
code: def to_json(self) -> Dict:
      """
      Map stats information into a json object
  
      Returns:
          A json that represents frequency count and total count
      """
  
      json_obj = dict()
      json_obj[STATSKEY.TOTAL_COUNT] = self._total_count
      json_obj[STATSKEY.DISTRIBUTION] = []
  
      for (
          attribute_name,
          attribute_count,
      ) in self._frequency_count.items():
          json_obj[STATSKEY.DISTRIBUTION].append(
              {
                  STATSKEY.DISTRIBUTION_KEY.ATTRIBUTE_NAME: attribute_name,
                  STATSKEY.DISTRIBUTION_KEY.ATTRIBUTE_COUNT: attribute_count,
              }
          )
  
      return json_obj
  
file_path: contextual-ai/xai/data/explorer/categorical/categorical_stats.py
imports: from typing import Dict
  from xai.data.abstract_stats import AbstractStats
  from xai.data.constants import STATSKEY
  from xai.data.exceptions import InvalidTypeError
label_desc: Use image node_id 4 for calling the CategoricalStats obj's underlying member method code with example usage: obj.to_json() and returns: json_obj