Serializable
Trait for types that can be serialized to JSON.
Implement this trait to enable automatic serialization with serialize().
Example: struct Person(Serializable): var name: String var age: Int
def to_json(self) -> String:
return '{"name":' + to_json_value(self.name) +
',"age":' + to_json_value(self.age) + '}'
var json = serialize(Person("Alice", 30)) # {"name":"Alice","age":30}
to_json
def to_json(self) -> String Serialize this object to a JSON string.