src/ClassBuilder.js
function(bool_return_object) {
                    var obj = { __joii_type: this.__joii__.name };

                    for (var key in this.__joii__.metadata) {
                        var val = this.__joii__.metadata[key];

                        if (val.serializable) {
                            
                            var getter_name = JOII.GenerateGetterName(val);
                            var currentValue = null;
                            if (typeof (this[getter_name]) === 'function') {
                                // use getter if it exists. This allows custom getters to translate the data properly if needed.
                                currentValue = this[getter_name]();
                            } else {
                                currentValue = this[val.name];
                            }

                            if (!val.is_enum && typeof (currentValue) === 'object' && currentValue !== null) {
                                if ('serialize' in currentValue) {
                                    obj[val.name] = currentValue.serialize(true);
                                } else {
                                    obj[val.name] = JOII.Compat.flattenObject(currentValue);
                                }
                            } else {
                                obj[val.name] = currentValue;
                            }
                        }
                    }

                    return obj;
                }
function(bool_return_object) {
                    var obj = { __joii_type: this.__joii__.name };

                    for (var key in this.__joii__.metadata) {
                        var val = this.__joii__.metadata[key];

                        if (val.serializable) {
                            
                            var getter_name = JOII.GenerateGetterName(val);
                            var currentValue = null;
                            if (typeof (this[getter_name]) === 'function') {
                                // use getter if it exists. This allows custom getters to translate the data properly if needed.
                                currentValue = this[getter_name]();
                            } else {
                                currentValue = this[val.name];
                            }

                            if (!val.is_enum && typeof (currentValue) === 'object' && currentValue !== null) {
                                if ('serialize' in currentValue) {
                                    obj[val.name] = currentValue.serialize(true);
                                } else {
                                    obj[val.name] = JOII.Compat.flattenObject(currentValue);
                                }
                            } else {
                                obj[val.name] = currentValue;
                            }
                        }
                    }

                    return obj;
                }
function ( bool_return_object ) { var obj = { __joii_type : this . __joii__ . name } ; for ( var key in this . __joii__ . metadata ) { var val = this . __joii__ . metadata [ key ] ; if ( val . serializable ) { var getter_name = JOII . GenerateGetterName ( val ) ; var currentValue = null ; if ( typeof ( this [ getter_name ] ) === 'function' ) { // use getter if it exists. This allows custom getters to translate the data properly if needed. currentValue = this [ getter_name ] ( ) ; } else { currentValue = this [ val . name ] ; } if ( ! val . is_enum && typeof ( currentValue ) === 'object' && currentValue !== null ) { if ( 'serialize' in currentValue ) { obj [ val . name ] = currentValue . serialize ( true ) ; } else { obj [ val . name ] = JOII . Compat . flattenObject ( currentValue ) ; } } else { obj [ val . name ] = currentValue ; } } } return obj ; }
Serializes all serializable properties of an object. Public members are serializable by default.

@return {Object}
Serializes all serializable properties of an object . Public members are serializable by default .