I'm trying to use a REST resource that accepts a node title and returns a JSON interpretation of a single field. This requires raw HTML that I can then use in DOMDocument. To get the rendered value of a node programmatically with filters applied I tried:
$field_value = $node->get('body')->getValue();
However this doesn't apply any of the filters such as converting newlines/carriage returns into <br/>
or striping out unwanted HTML tags. I don't intend to send this to a Twig template so I need the rendered value in a string rather than a render array.
How can I do that?