public static function toJson($input = false, $pretty = false) {

        if ($input) {

            switch (Data::type($input)) {
                case 'array':
                    $json = self::arrayToJson($input, $pretty);
                    break;
                case 'object':
                    $json = self::objectToJson($input, $pretty);
                    break;
                default:
                    $json = false;
                    break;
            }

            if (Validate::isJson($json)) {

                return $json;
            }
        }

        return false;
    }