Closed bitnom closed 4 years ago
json.dumps(team, default=lambda o: from_data(o))
may work. Give me some time to add some serialization tests; this short code does not handle FlatList
(also found in this module).
I agree it is important that Data
be able to serialize to JSON easily using the standard library. I use mo-json to perform the JSON serialization; I do not expect you to need that to do this.
.... confirmed: It can be done like so:
json.dumps(team, default=from_data)
@TensorTom reopen if there are other combinations that cause problems.
I have a rather complex codebase in which I was previously dumping the dict form of my data to a JSON file. I refactored the entire code to use mo-dots only to finally encounter an error dumping to JSON:
Is it possible to stringify Data objects?