On Apr 8, 2020, at 01:18, Wes Turner firstname.lastname@example.org wrote:
I don't see the value in using JSON to round-trip from Python to the same Python code.
External schema is far more useful than embedding part of an ad-hoc nested object schema in type annotations that can't also do or even specify data validations.
But dataclasses with type annotations can express a complete JSON Schema. Or, of course, in an ad hoc schema only published in human readable form, as most web APIs use today.
You can already jsonpickle data classes. If you want to share or just publish data, external schema using a web standard is your best bet.
Sure, but you don’t need JSON-LD for that. Again, the fact that type annotations are insufficient to represent semantic triples is irrelevant. They are sufficient for the case of writing code to parse what YouTube gives you, or to provide a documented API that you design to be consumed by other people in JS, or to generate a JSON Schema from your legacy collection of classes that you can then publish, or to validate that a dataclass hierarchy matches a published schema, and so on. All of which are useful.