iwfm.diagnostics.serialize_bundle

iwfm.diagnostics.serialize_bundle(bundle, output_path=None, indent=2, max_list_items=15, float_precision=3)[source]

Convert DiagnosticBundle to compact JSON string.

Parameters:
  • bundle (DiagnosticBundle) – Assembled diagnostic bundle.

  • output_path (str, optional) – If provided, write JSON to this file.

  • indent (int) – JSON indentation.

  • max_list_items (int) – Truncate lists longer than this.

  • float_precision (int) – Round floats to this many decimal places.

Returns:

JSON string.

Return type:

str