ssapy_toolkit.IO.json_utils

Functions

append_json(filename, new_data)

Append data into an existing JSON file.

load_json(filename)

Load data from a JSON file and decode special types.

read_json(filename)

save_json(filename, data)

Save data to a JSON file with support for NumPy, datetime, and Astropy Time.

ssapy_toolkit.IO.json_utils.append_json(filename: str, new_data) None[source]

Append data into an existing JSON file.

  • If root is a dict:
    • For each key in new_data:
      • If key exists and is a list, extend or append.

      • If key exists and is not a list, convert to list and append.

      • If key does not exist, add it.

  • If root is a list, append or extend.

  • If file does not exist, save new_data as-is.

  • If types mismatch, wrap both into a list.

ssapy_toolkit.IO.json_utils.load_json(filename: str)[source]

Load data from a JSON file and decode special types.

ssapy_toolkit.IO.json_utils.read_json(filename: str)[source]
ssapy_toolkit.IO.json_utils.save_json(filename: str, data) None[source]

Save data to a JSON file with support for NumPy, datetime, and Astropy Time.