Skip to content
Snippets Groups Projects
Commit 9badae10 authored by Simon Künzel's avatar Simon Künzel
Browse files

Fix bug in JSON deserialization: Don't modify input

parent 72495d43
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment