Serializes an ABL class-based object to the specified JSON stream.
Return type: VOID
Access: PUBLIC
Applies to: Progress.IO.JsonSerializer class
Serialize( INPUT object-reference AS Progress.Lang.Object, INPUT output-stream AS Progress.IO.OutputStream ) |
The following code sample serializes and deserializes myObj:
DEFINE VARIABLE myFileOutStream AS Progress.IO.FileOutputStream. DEFINE VARIABLE myFileInStream AS Progress.IO.FileInputStream. DEFINE VARIABLE mySerializer AS Progress.IO.JsonSerializer. DEFINE VARIABLE myObj AS Acme.MyClass. myObj = NEW Acme.MyClass(). mySerializer = NEW Progress.IO.JsonSerializer(FALSE). /* Serialize object */ myFileOutStream = NEW Progress.IO.FileOutputStream("MyClass.json"). mySerializer:Serialize(myObj, myFileOutStream). myFileOutStream:Close(). /* Deserialize object */ myFileInStream = NEW Progress.IO.FileInputStream("MyClass.json"). myObj = CAST(mySerializer:Deserialize(myFileInStream), Acme.MyClass). myFileInStream:Close(). |