by __MatrixMan__ · 2y ago · 0 comments
@deriving(json)
class Person:
id: int
name: str
Would give you something like: def parse(s: str): Person: ...
def print(p: Person): str: ... record User(string Name, DateOnly DoB);
[JsonSerializable(typeof(User))]
partial class SerializerContext: JsonSerializerContext;
...
var user = new User("John", new(1984, 1, 1));
var response = await http.PostAsJsonAsync(
url, user, SerializerContext.Default.User);