Get text block content as JSON without HTML tags?

I’m using a [template].php.json file to make the content of some page available in JSON. This includes text content from a layout with text blocks. Is it possible to output the text in JSON without the HTML tags?

At the moment, calling the template returns the following for the text block content:

{
"type": "text",
"text": {
      "value ": "<p>Some text content here...</p>"
   }
}

I simply need it like this:

{
"type": "text",
"text": {
      "value ": "Some text content here..."
   }
}

The code in the template file for creating the JSON data:

$blocks_formatted = []

foreach($blocks as $b) {
  array_push($blocks_formatted, [
    'type' => $b->type(),
    'text' => $b->text()->value()
  ]);
}

$data = {
  'title'  => $page->title()->value(),
  'blocks' => $blocks_formatted
}

echo json_encode($data);

Never mind, thoughtless question. PHP provides the strip_tags() method which removes all HTML and PHP tags from a string:

$blocks_formatted = []

foreach($blocks as $b) {
  array_push($blocks_formatted, [
    'type' => $b->type(),
    'text' => strip_tags($b->text()->value())
  ]);
}

$data = {
  'title'  => $page->title()->value(),
  'blocks' => $blocks_formatted
}

echo json_encode($data);