Beispiel #1
0
 public function JSON()
 {
     return \Psc\JS\Helper::reformatJSON(json_encode($this->exportJSON()));
 }
Beispiel #2
0
 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));
     }
 }