Render form element of type text_format, keeping WYSYWIG format
The solution is render it using the #type =&gt; processed_text. That's it, then you will see the element renderd keeping the format used in WYSYWIG.

$elements = [
  '#type' =&gt; 'processed_text',
  '#text' =&gt; $data,
  '#format' =&gt; 'full_html',
  '#langcode' =&gt; 'en',
];