Node.js examples for Data Type:Serialization
Serialization functions for the complex datatypes
/**/* ww w.j a va 2 s .c om*/ * Serialization functions for the complex datatypes. It reuses the * other serialization functions to serialize the members of the object. */ Object.prototype.serialize = function() { var result = '<struct>'; for ( var member in this ) { if ( typeof( this[ member ] ) != 'function' ) { result += '<member>'; result += '<name>' + member + '</name>'; result += '<value>' + this[ member ].serialize() + '</value>'; result += '</member>'; } } result += '</struct>'; return result; }