When I was trying to serialize an object in Action Message Format (AMF) , I faced a problem in deserialized it which was null object value, after some goggling I found the solution:
I preserve the class (type) of any object before encoding in Action Message Format (AMF), so that it can be deserialized when decoding the object, so If the encoding context did not register an alias for an object's class, the object is encoded as an anonymous object. Similarly, if the decoding context does not have the same alias registered, an anonymous object is created for the decoded data.
Finally we can register class using one of the following ways:
-
using function registerClassAlias("path to your class", your class);
-
using the metadata [RemoteClass(alias = "path to your class")]