getJsonResponse

@param $data $data

@return \Zend\Stdlib\ResponseInterface
545407
public function getJsonResponse($data)
    {
        $view = new JsonModel();
        $view->setTerminal(true);

        $response = $this->getResponse();
        $response->setContent(json_encode($data));

        return $response;
    }
230388
protected function createResponse($data = null)
    {
        $view = new View();
        $view->setData($data);

        $context = $view->getSerializationContext();
        if ($this->serialization->isCheckDepth()) {
            $context->enableMaxDepthChecks();
        }
        $context->setGroups($this->serialization->getGroups());

        $view->setSerializationContext($context);

        return $this->handleView($view);
    }
222462
public function sendData($data)
    {
        $httpResponse = $this->sendRequest($data);

        $responseClass = $this->getResponseClassName();
        return $this->response = new $responseClass($this, $httpResponse);
    }
420306
protected function jsonResponse($data = array())
    {
        $this->view->disable();
        $this->response->setContentType('application/json', 'UTF-8');

        return $this->response->setJsonContent($data);
    }
114344
public static function createFromDecodedJsonResponse($data)
    {
        $areas = [];
        foreach ($data as $name => $area) {
            $areas[$name] = [];
            foreach ($area as $class => $data) {
                $metaClass = DynamicMetadataHelper::getDynamicMetadataClassName($class);
                /* @var DynamicMetadataInterface $metaClass */
                $areas[$name][] = $metaClass::createFromDecodedJsonResponse($data);
            }
        }

        return new self($areas);
    }
777918
private function dataToJson($data)
        {
            $cols = $this->getColumns($data);

            $rows = [];

            foreach ($data as $key => $row) {
                if ($key != 0 || !$this->_skipFirstRow) {
                    $c = [];

                    foreach ($row as $v) {
                        $c[] = ['v' => $v];
                    }

                    $rows[] = ['c' => $c];
                }
            }

            return json_encode(['cols' => $cols, 'rows' => $rows]);
        }
180283
private function prepareResponseData($data)
    {
        switch (true)
        {
            case is_object($data):
                if (method_exists($data, 'toArray'))
                {
                    $data = $data->toArray();
                }
                else
                {
                    $data = get_object_vars($data);
                }
                $data = $this->prepareResponseData($data);
                break;
            case is_array($data):
                foreach ($data as $key => $value)
                {
                    $data[$key] = $this->prepareResponseData($value);
                }
                break;
        }
        return $data;
    }
985754
public function getAuthorizationResponse($data)
    {
        $this->makePaymentRequest($data);

        $this->url = $this->getResponse()['data']['authorization_url'];

        return $this->getResponse();
    }
771705
public static function createFromDecodedJsonResponse($data)
    {
        if (!isset($data['user_metadata'])) {
            $data['user_metadata'] = [];
        } else {
            foreach ($data['user_metadata'] as $key => $value) {
                if (0 === strpos($key, 'date:')) {
                    $data['user_metadata'][$key] = new \DateTime($value);
                }
            }
        }
        if (!isset($data['static_metadata'])) {
            $data['static_metadata'] = [];
        }

        $dynamic_metadata = [];

        // Rebuild the DynamicMetadata associated to the current SourceImage
        if (isset($data['dynamic_metadata'])) {
            foreach ($data['dynamic_metadata'] as $name => $metadata) {
                $metadata = DynamicMetadataHelper::buildDynamicMetadata($name, $metadata);
                if ($metadata) {
                    $dynamic_metadata[$name] = $metadata;
                }
            }
        }

        return new self(
            $data['organization'],
            $data['binary_hash'],
            $data['hash'],
            $data['name'],
            $data['format'],
            $data['size'],
            $data['width'],
            $data['height'],
            $data['user_metadata'],
            $dynamic_metadata,
            $data['static_metadata'],
            new \DateTime($data['created']),
            $data['link'],
            $data['short_hash']
        );
    }
600980
protected function jsonEncode(array $data)
    {
        set_error_handler(function () {
            $this->handleJsonError(JSON_ERROR_SYNTAX);
        }, E_WARNING);
        
        $json = json_encode($data, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
        restore_error_handler();
        $this->handleJsonError(json_last_error());
        
        return $json;
    }
1242604
protected function parseJson($data)
    {
        $result = json_decode(trim($data), false);

        return json_last_error() == JSON_ERROR_NONE ? $result : false;
    }
1159660
private function convertToJson($data)
    {
        if (is_array($data)) {
            return json_encode($data);
        }

        if ($data instanceof Jsonable) {
            return $data->toJson();
        }

        if ($data instanceof Arrayable) {
            return json_encode($data->toArray());
        }

        return null;
    }
688272
public function sendData($data)
    {
        $request = new AopNotifyRequest($this->httpClient, $this->httpRequest);
        $request->initialize($this->parameters->all());
        $request->setEndpoint($this->getEndpoint());
        $request->setParams($data);
        $request->setSort(false);
        $request->setEncodePolicy(Signer::ENCODE_POLICY_JSON);
        $request->setAlipayPublicKey($this->getAlipayPublicKey());

        /**
         * @var AopNotifyResponse $response
         */
        $response = $request->send();

        return $response;
    }
141714
protected function responseJson($data, $status = null, $encodingOptions = 0)
    {
        $body = $this->_response->getBody();
        $body->rewind();
        $body->write($json = json_encode($data, $encodingOptions));
        // Ensure that the json encoding passed successfully
        if ($json === false) {
            throw new \RuntimeException(json_last_error_msg(), json_last_error());
        }
        $responseWithJson = $this->_response->withHeader('Content-Type', 'application/json;charset=utf-8');
        if (isset($status)) {
            return $responseWithJson->withStatus($status);
        }
        return $responseWithJson;
    }
367534
public static function sendJson($data = null, $headers = [])
    {
        $response = new static($data, $headers);
        $response->send();

        return $response;
    }
245339
public static function arr2json($data)
    {
        $json = json_encode(self::buildEnEmojiData($data), JSON_UNESCAPED_UNICODE);
        return $json === '[]' ? '{}' : $json;
    }
779885
public function writeJson($data)
    {
        $data = json_encode($data);

        $this->write($data);
        $this->addHeader("Content-Type", "application/json");

        return $this;
    }