Files
seagull-game/app/pylocal/jsonizer.py

13 lines
420 B
Python
Raw Normal View History

2025-08-05 17:57:43 -07:00
import json
from . import items
## \brief Extended JSON encoder object to handle seagull-specific items.
# \internal
2025-08-05 17:57:43 -07:00
class JSONizer(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, items.TickItem):
return {"resource": obj.resource, "amount": obj.amount, "desc": obj.desc}
else:
# if no encoding here, fall back to stdlib
return super().default(obj)