Open FCO opened 2 years ago
I've thought about this before, my difficulty has been that there is no firm specification for this kind of metadata in JSON (unlike e.g. XML namespaces,) and JSON has typically depended on contextual or out-of-band metadata (e.g. media type or special HTTP headers,) for this kind of thing. If one was using Cro::HTTP
then it would be possible to create a specialised BodyParser that could map the out-of-band metadata to a particular type to deserialize the JSON to.
If there were to be some theoretical specification for in-band JSON metadata like this (something like JSON-LD for instance, ) then I would see the implementation as sitting on top of JSON::Class as a separate module rather than as part of it as the specification is likely to move more quickly than the underlying requirement to deserialise JSON to a known type.
Sorry, it’s a question rather than an issue, but is there a way of deserializing without knowing the class? Maybe a way to add the class name on the serialised json to make it possible to find out what class to use…