make_json_dict

make_json_dict(tdf,
               tic_dat,
               verbose=False,
               use_infinity_io_flag_if_provided=False)

JsonTicFactory

JsonTicFactory(self, tic_dat_factory)

Primary class for reading/writing json files with TicDat objects. You need the json package to be installed to use it.

create_tic_dat

JsonTicFactory.create_tic_dat(json_file_path,
                              freeze_it=False,
                              from_pandas=False)

Create a TicDat object from a json file

:param json_file_path: A json file path. It should encode a dictionary with table names as keys. Could also be an actual JSON string

:param freeze_it: boolean. should the returned object be frozen?

:param from_pandas: boolean. If truthy, then use pandas json readers. See PanDatFactory json readers for more details. This argument is historical, as a json format that matches the PanDatFactory.json format will be detected automatically, and thus client code is generally safe ignoring this argument completely.

:return: a TicDat object populated by the matching tables.

caveats: Table names matches are case insensitive and also underscore-space insensitive. Tables that don't find a match are interpreted as an empty table. Dictionary keys that don't match any table are ignored.

find_duplicates

JsonTicFactory.find_duplicates(json_file_path, from_pandas=False)

Find the row counts for duplicated rows.

:param json_file_path: A json file path. It should encode a dictionary with table names as keys.

:param from_pandas: boolean. If truthy, then use pandas json readers. See PanDatFactory json readers for more details.

:return: A dictionary whose keys are table names for the primary-ed key tables. Each value of the return dictionary is itself a dictionary. The inner dictionary is keyed by the primary key values encountered in the table, and the value is the count of records in the json entry with this primary key. Row counts smaller than 2 are pruned off, as they aren't duplicates

write_file

JsonTicFactory.write_file(tic_dat,
                          json_file_path,
                          allow_overwrite=False,
                          verbose=False,
                          to_pandas=False)

write the ticDat data to a json file (or json string)

:param tic_dat: the data object to write (typically a TicDat)

:param json_file_path: The file path of the json file to create. If empty string, then return a JSON string.

:param allow_overwrite: boolean - are we allowed to overwrite an existing file?

:param verbose: boolean. Verbose mode writes the data rows as dicts keyed by field name. Otherwise, they are lists.

:param to_pandas: boolean. if truthy, then use the PanDatFactory method of writing to json.

:return: