I know that you can mark a scala object as @serializable, but I don’t understand what to do with the object afterwards. Do I simply treat it as a Java Serializable object?
I want to serialize the object into a stream of bytes. Can someone show me the code to transform a serialize object into either a byte array or a string?
(the googles have not been helpful with this question)
FOLLOWUP: Thanks. I now understand that I can use it like a Java Serializable object. Sometimes the obvious answer escapes me.
To answer your first question: yes you can treat it as a Java Serializable object:
If you want to serialize to some string format, perhaps this library may be useful, which serializes scala objects into JSON.