code: def test_to_json(self):
      tdm = build_hamlet_jz_term_doc_mat()
      # with self.assertRaises(NoWordMeetsTermFrequencyRequirementsError):
      # 	ScatterChart(term_doc_matrix=tdm).to_dict('hamlet')
      j = ScatterChart(
          term_doc_matrix=tdm, minimum_term_frequency=0
      ).to_dict("hamlet")
      self.assertEqual(set(j.keys()), set(["info", "data"]))
      self.assertEqual(
          set(j["info"].keys()),
          set(
              [
                  "not_category_name",
                  "category_name",
                  "category_terms",
                  "not_category_terms",
                  "category_internal_name",
                  "not_category_internal_names",
                  "neutral_category_internal_names",
                  "extra_category_internal_names",
                  "categories",
              ]
          ),
      )
      expected = {
          "x": 0.0,
          "y": 0.42,
          "ox": 0,
          "oy": 0.42,
          "term": "art",
          "cat25k": 758,
          "ncat25k": 0,
          "neut25k": 0,
          "neut": 0,
          "extra25k": 0,
          "extra": 0,
          "s": 0.5,
          "os": 3,
          "bg": 3,
      }
      datum = self._get_data_example(j)
      for var in ["cat25k", "ncat25k"]:
          np.testing.assert_almost_equal(
              expected[var], datum[var], decimal=1
          )
      self.assertEqual(set(expected.keys()), set(datum.keys()))
      self.assertEqual(expected["term"], datum["term"])
  
imports: import sys
  from unittest import TestCase
  import numpy
  import pandas
  from scattertext import LogOddsRatioUninformativeDirichletPrior, scale
  from scattertext import ScatterChart
  from scattertext.ScatterChart import CoordinatesNotRightException, TermDocMatrixHasNoMetadataException, NeedToInjectCoordinatesException
  from scattertext.test.test_corpusFromPandasWithoutCategories import get_term_doc_matrix_without_categories
  from scattertext.test.test_semioticSquare import get_test_corpus
  from scattertext.test.test_termDocMatrixFactory import build_hamlet_jz_term_doc_mat, build_hamlet_jz_corpus_with_meta
label_desc: Use image node_id 1 for calling the TestScatterChart obj's underlying member method code with example usage: obj.test_to_json() without return types