From e0e7793f06cbbe491d9e9218f5673d831a856378 Mon Sep 17 00:00:00 2001 From: Claas Date: Sat, 25 Nov 2023 16:31:56 +0100 Subject: [PATCH] write_traffic_situation_to_file.py: exclude fields the value of which is either None or has not been actively set after instantiation. --- src/trafficgen/write_traffic_situation_to_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trafficgen/write_traffic_situation_to_file.py b/src/trafficgen/write_traffic_situation_to_file.py index c8c578a..5a6ba2a 100644 --- a/src/trafficgen/write_traffic_situation_to_file.py +++ b/src/trafficgen/write_traffic_situation_to_file.py @@ -21,7 +21,8 @@ def write_traffic_situations_to_json_file(situations: List[Situation], write_fol output_file_path: Path = write_folder / f"traffic_situation_{file_number:02d}.json" data: str = situation.model_dump_json( indent=4, - exclude_defaults=True, + exclude_unset=True, + exclude_defaults=False, exclude_none=True, ) with open(output_file_path, "w", encoding="utf-8") as outfile: