Save a format for a node body How do I save the format used for a node body?

I am using the following code, but it doesn't work.

$article = Node::create(array('type' =&gt; 'article'));
$article-&gt;setTitle($node-&gt;title);
$article-&gt;set('body', "My body...");
$article-&gt;setPublished(TRUE);
$article-&gt;body-&gt;format = 'full_html';
$article-&gt;save();


How can I achieve this?

EDIT:

Fixed:

Right code:

$article = Node::create(array('type' =&gt; 'article'));
$article-&gt;setTitle($node-&gt;title);
$article-&gt;body-&gt;value = $node-&gt;body;
$article-&gt;body-&gt;format = 'full_html';
$article-&gt;setPublished(TRUE);
$article-&gt;save();
// $node is supposed to be previously defined node object.

$article = Node::create(array(
  'type'     =&gt; 'article',
  'langcode' =&gt; 'en,
  'title'    =&gt; $node-&gt;title-&gt;value,
  'body'     =&gt; ['value' =&gt; $node-&gt;body-&gt;value, 'format' =&gt; 'full_html'],
  'status'   =&gt; 1,
));
$article-&gt;save();


This is the code if in case, anyone wants it.