Modern way to convert python dataclasses or other objects to and from more common types like dicts or json-like structures