AMF serialization/deserialization for JS