Serializes the property values of an Javascript object by a given rule set