Open amnaredo opened 3 years ago
upickle does not know how to serialize Object
.
I think you'll need to give a more specific type to it, for example by creating a sealed trait with subtypes that wrap your String and Map[String, String], and then give upickle a Map[String, YourSealedTreait] instead of Map[String, Object].
ETA: Of course, you will need to define serializers for the sealed trait and its subtypes as explained in upickle docs. Original Author: raquo
Thank you, I've read about that in the doc, but my use case is actually to serialize arbitrary maps. Do you have recommendation for that? Original Author: wiradikusuma
I don't think what you're looking for is possible with upickle. upickle does not usually store type information in the serialized JSON string (except for sealed traits / enums). So when deserializing, you need to know which type you're deserializing into, and have a deserializer available for that type.
If this really is a requirement, try to find a library that encodes the types in serialized strings. I'm not sure which ones do that. That seems complicated to pull off. Original Author: raquo
You can also construct a Js.Value yourself out of Js.Objs if you want a heterogenous JSON tree
On Thu, 17 May 2018 at 11:08 PM, Nikita Gazarov notifications@github.com wrote:
I don't think what you're looking for is possible with upickle. upickle does not usually store type information in the serialized JSON string (except for sealed traits / enums). So when deserializing, you need to know which type you're deserializing into, and have a deserializer available for that type.
If this really is a requirement, try to find a library that encodes the types in serialized strings. I'm not sure which ones do that.
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/lihaoyi/upickle/issues/231#issuecomment-390104408, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5A_L8nhRTCy3u9BNCRMY-GqHf5jQSqks5tzmVYgaJpZM4UEJP2 .
Original Author: lihaoyi
This simple mixed-content Map fails during compilation:
With this error:
ID: 231 Original Author: wiradikusuma