11 lines
334 B
Python
11 lines
334 B
Python
import json
|
|
|
|
from . import items
|
|
|
|
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) |