In aAM

\n"; if ($response instanceof JsonResponse) { $content = $response->getContent(); $raw = json_decode($content, TRUE); $raw[] = $MESSAGE; $newContent = json_encode($raw); $response->setContent($newContent); return $response; } // Only echo info on text responses. $ct = $response->headers->get('Content-Type'); if (isset($ct) && strpos($ct, 'text') !== 0) { return; } echo $MESSAGE; } }