Files
schn33fuchs 0e9d343b1e Project structure and classes
Project structure and classes created and initialized
2026-06-01 20:12:20 +02:00

13 lines
341 B
Python

class Item:
def __init__(self, id, name, price) -> None:
self.id = id
self.name = name
self.price = float(price)
def to_json(self):
return {"id": self.id, "name": self.name, "price": self.price}
@staticmethod
def from_json(data):
return Item(data["id"], data["name"], data["price"])