JSONExporter β€” JSON Export

class sloth.mmcif.exporter.JSONExporter[source]

Bases: BaseExporter

Export mmCIF data to nested JSON format.

__init__(dict_path=None, cache_dir=None, quiet=False, denormalize=False)[source]

Initialize the JSON exporter.

Parameters:
  • dict_path (Union[str, Path, None]) – Path to mmCIF dictionary file

  • cache_dir (Optional[str]) – Directory for caching

  • quiet (bool) – Suppress output messages

  • denormalize (bool) – If True, embed reference/lookup data for full denormalization

export_data(mmcif_data, file_path=None, indent=None)[source]

Export mmCIF data to JSON format (always nested).

Parameters:
  • mmcif_data (MMCIFDataContainer) – The mmCIF data container to export

  • file_path (Union[str, Path, None]) – Path to save the file (optional)

  • indent (Optional[int]) – Number of spaces for indentation (None for compact output)

Return type:

Optional[str]

Returns:

JSON string if no file_path provided, otherwise None