Validating a node body
You get the outputs message as an array, because you supplied $body and $title as arrays, and $form_state-&gt;getValue('author'); doesn't give you author of node test with the following code:

function test_form_alter(&amp;$form, FormStateInterface $form_state) {
  // Custom validate function.
  $form['#validate'][] = 'validateForm';
}

function validateForm(array &amp;$form, FormStateInterface $form_state) {
  //- Get the author id.
  $author_uid = $form_state-&gt;getValue('uid')[0]['target_id'];
  // Load the author account.
  $author = User::load($author_uid);
  //- Get the body value, if you want just the summary change value by summary. 
  $body = $form_state-&gt;getValue('body')[0]['value'];
  //- Get the title value .
  $title = $form_state-&gt;getValue('title')[0]['value'];
  //- Use addMessage instead of drupal_set_message its deprecated.
  \Drupal::messenger()-&gt;addMessage('Thanks for submitting the form! you typed in the following as author:' . $author-&gt;getAccountName() . ' . body:' . $body . '. title:' . $title);
}


Don't forget to add the following use:

use Drupal\Core\Form\FormStateInterface;
use Drupal\user\Entity\User;