diff --git a/common_py/src/videoag_common/miscellaneous/json_serializable.py b/common_py/src/videoag_common/miscellaneous/json_serializable.py index 82ca3c39e9965a8b576d69f55defeb3cc96987e5..dd642158aa2fa964e035280ae5e69c02c6dc3a45 100644 --- a/common_py/src/videoag_common/miscellaneous/json_serializable.py +++ b/common_py/src/videoag_common/miscellaneous/json_serializable.py @@ -426,8 +426,8 @@ class TypedJsonDataClass[T: str or "JsonSerializableEnum"](JsonDataClass): if type_str not in cls.__classes_by_json_str_type__: json.get("type").raise_error(f"Unknown type '{type_str}'. Possible values: {', '.join(cls.__classes_by_json_str_type__.keys())}") - # Remove type from data - raw_json = json.get_unsafe_data() + # Remove type from data on a COPY! Very IMPORTANT, otherwise weird things happen! + raw_json = dict(json.get_unsafe_data()) raw_json.pop("type") json = CJsonObject(raw_json) return cls.__classes_by_json_str_type__[type_str].from_json(json, _do_type_check=False)