public function JSON() { return \Psc\JS\Helper::reformatJSON(json_encode($this->exportJSON())); }
protected function createJSONResponse($body) { if ($body instanceof \Psc\JS\JSON) { return $this->createResponse($body->JSON()); } elseif (is_array($body) || is_object($body) && $body instanceof \stdClass) { return $this->createResponse($this->prettyPrintJSON ? \Psc\JS\Helper::reformatJSON(json_encode($body)) : json_encode($body)); } elseif ($body instanceof \Psc\Data\Exportable) { $body = $body->export(); return $this->createResponse($this->prettyPrintJSON ? \Psc\JS\Helper::reformatJSON(json_encode($body)) : json_encode($body)); } }