Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit ad6f0da

Browse files
committed
Fix serialization issue for JSON dumps in "show states" mode
This implements a generic fix to use `repr()` for data to be encoded to JSON values that would normally cause errors like: `TypeError: Object of type datetime is not JSON serializable` Signed-off-by: Tobias Wolf <[email protected]>
1 parent 94a029c commit ad6f0da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rookify/modules/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def ssh(self) -> SSH:
6262
return self._ssh
6363

6464
def _get_readable_json_dump(self, data: Any) -> Any:
65-
return json.dumps(data, sort_keys=True, indent="\t")
65+
return json.dumps(data, default=repr, sort_keys=True, indent="\t")
6666

6767
def get_readable_key_value_state(self) -> Optional[Dict[str, str]]:
6868
"""

0 commit comments

Comments
 (0)