diff --git a/python/podio_gen/generator_utils.py b/python/podio_gen/generator_utils.py index cdfbe9067..6bd6e0f48 100644 --- a/python/podio_gen/generator_utils.py +++ b/python/podio_gen/generator_utils.py @@ -5,6 +5,7 @@ import re import json +from copy import deepcopy def _get_namespace_class(full_type): @@ -324,7 +325,11 @@ def __init__( def _to_json(self): """Return the dictionary, so that we can easily hook this into the pythons JSON ecosystem""" - return self.__dict__ + definition = deepcopy(self.__dict__) + # Only dump the version information if it's populated + if definition["version_info"] is None: + del definition["version_info"] + return definition class DataModelJSONEncoder(json.JSONEncoder):