index.js
function convertToJsonOnValidate(any) {
  var validate = any._validate;
  any._validate = function () {
    var result = validate.apply(this, arguments);
    if (!result.error && result.value) {
      result.value = JSON.stringify(result.value);
    }
    return result;
  };
  return any;
}
function convertToJsonOnValidate(any) {
  var validate = any._validate;
  any._validate = function () {
    var result = validate.apply(this, arguments);
    if (!result.error && result.value) {
      result.value = JSON.stringify(result.value);
    }
    return result;
  };
  return any;
}
function convertToJsonOnValidate ( any ) { var validate = any . _validate ; any . _validate = function ( ) { var result = validate . apply ( this , arguments ) ; if ( ! result . error && result . value ) { result . value = JSON . stringify ( result . value ) ; } return result ; } ; return any ; }
Convert the resulting object back to JSON after validation.

* Warning: This relies on the internal structure of a joi object

@param {Joi} any - the object that will be extended to convert the given value
@returns {Joi} - the extended validator
Convert the resulting object back to JSON after validation .