convertToJson example

// decide if we should render the data or the whole page         if ($this->renderer === true) {
            $content = $subject->View()->getAssign();
        } elseif (\is_string($this->padding) && $this->padding !== '') {
            $content = $response->getBody();
        } else {
            return;
        }

        // Convert content to json         $content = $this->convertToJson($content);

        if (\is_string($this->padding) && $this->padding !== '') {
            $response->setHeader('Content-type', 'text/javascript', true);
            $response->setBody($this->addPadding($content$this->padding));
        } elseif ($this->renderer === true) {
            $response->setHeader('Content-type', 'application/json', true);
            $response->setBody($content);
        }

        $this->padding = null;
        $this->encoding = 'UTF-8';
        
Home | Imprint | This part of the site doesn't use cookies.