diff --git a/TypesOfValidator.php b/TypesOfValidator.php index 5e4cd55..9844e56 100644 --- a/TypesOfValidator.php +++ b/TypesOfValidator.php @@ -63,7 +63,7 @@ class TypesOfValidator extends BaseValidator */ public function jsonFormat($field, $value): bool { - if (is_null(json_decode($value))) { + if (!is_string($value) || is_null(json_decode($value))) { return $this->addError($field, 'The ' . $field . ' not is JSON data.'); } return true;