You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Converting the business objects to/from JSON AST is currently not supported due to the design of the library. Still this is something that would be useful in some cases.
My primary motivation is to be able to reuse an existing YAML implementation such as SnakeYAML to provide yaml support on top of zio-json. Other use cases could be some kind of transformation that is easier to perform on the JSON AST than the original model, etc.
I was thinking of the following implementation:
Adding an toJsonAST in JsonEncoder and a fromJsonAST to JsonDecoder
Have a default implementation for these which does a roundtrip serialization through a memory buffer
Provide overrides for the primitive types doing the conversion directly
Also the derive macro could generate implementations to avoid the performance loss of encoding/decoding during the conversion
Mixing this into the existing encoder and decoder type classes may seem a bit ugly but I think having it automatically available without the need to create additional implicits is a big advantage.
The text was updated successfully, but these errors were encountered:
Converting the business objects to/from JSON AST is currently not supported due to the design of the library. Still this is something that would be useful in some cases.
My primary motivation is to be able to reuse an existing YAML implementation such as SnakeYAML to provide yaml support on top of zio-json. Other use cases could be some kind of transformation that is easier to perform on the JSON AST than the original model, etc.
I was thinking of the following implementation:
toJsonAST
inJsonEncoder
and afromJsonAST
toJsonDecoder
Mixing this into the existing encoder and decoder type classes may seem a bit ugly but I think having it automatically available without the need to create additional implicits is a big advantage.
The text was updated successfully, but these errors were encountered: