Bolt\Storage\Field\Type\FieldTypeBase::isJson PHP Method

isJson() protected method

Check if a value is a JSON string.
protected isJson ( mixed $value ) : boolean
$value mixed
return boolean
    protected function isJson($value)
    {
        if (!is_string($value)) {
            return false;
        }
        json_decode($value);
        return json_last_error() === JSON_ERROR_NONE;
    }