<?php

$blocks = $page->testBlocks()->toBlocks()->toArray();
$specificData = [
  'blocks' => $blocks
];

$pageData = array_merge($genericData, $specificData);

echo json_encode([
  "page" => $pageData,
  "user" => $userData
]);