Return a formatted ResponseJson

@param array $mdata
@param array $mergedData
@param null $status
@param string $msg
@param array $headers
@param int $options
@return JsonResponse
1006
public static function responseJsonMerge($mdata = array(), $mergedData, $status = null, $msg = '', array $headers = array(), $options = 0)
    {
        $response = self::responseMerge($mdata, $mergedData, $status, $msg);
        return Response::json($response, $response['status'], $headers, $options);
    }
1304043
protected function _prepareMessage($data, array $options)
    {
        $attributes = [];

        $options += [
            'silent' => false,
            'compress' => true,
            'serializer' => extension_loaded('msgpack') ? 'msgpack' : 'json',
            'delivery_mode' => 1
        ];

        switch ($options['serializer']) {
            case 'json':
                $data = json_encode($data);
                $attributes['content_type'] = 'application/json';
                break;

            case 'text':
                $attributes['content_type'] = 'application/text';
                break;

            default:
                throw new RuntimeException('Unknown serializer: ' . $options['serializer']);
        }

        if (!empty($options['compress'])) {
            $data = gzcompress($data);
            $attributes += ['content_encoding' => 'gzip'];
        }

        if (!empty($options['delivery_mode'])) {
            $attributes['delivery_mode'] = $options['delivery_mode'];
        }

        return [$data, $attributes, $options];
    }
487364
public function toResponse($status = 200, array $headers = [], $options = 0)
    {
        return new JsonResponse($this->transform(), $status, $headers, $options);
    }
545407
public function getJsonResponse($data)
    {
        $view = new JsonModel();
        $view->setTerminal(true);

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

        return $response;
    }
982385
public static function decode($msg)
    {
        try {
            $data = json_decode($msg, true);

            return $data;
        } catch (\Exception $e) {
            throw new \InvalidArgumentException('Invalid json format');
        }
    }
207121
public function json(array $data, $status = 200, $encodingOptions = 0)
    {
        return $this->response->withJson($data, $status, $encodingOptions);
    }
32018
public static function createFromDecodedJsonResponse($data)
    {
        $stack_operations = [];
        if (isset($data['stack_operations']) && \is_array($data['stack_operations'])) {
            foreach ($data['stack_operations'] as $operation) {
                $stack_operations[] = StackOperation::createFromDecodedJsonResponse($operation);
            }
        }

        $stack = new self(
            $data['organization'],
            $data['name'],
            $stack_operations,
            [],
            new \DateTime($data['created'])
        );

        if (isset($data['stack_options']) && \is_array($data['stack_options'])) {
            $stack->setStackOptions($data['stack_options']);
        }

        if (isset($data['stack_variables']) && \is_array($data['stack_variables'])) {
            $stack->setStackVariables($data['stack_variables']);
        }

        if (isset($data['stack_expressions']) && \is_array($data['stack_expressions'])) {
            $stack_expressions = [];
            foreach ($data['stack_expressions'] as $expression) {
                $stack_expressions[] = StackExpression::createFromDecodedJsonResponse($expression);
            }

            $stack->setStackExpressions($stack_expressions);
        }

        return $stack;
    }
596730
private function sendTypeData($typeData) {
        switch($typeData) {
            case self::DATA_JSON:
                header(self::CONTENT_TYPE_JSON);
                http_response_code($this->status);
                $this->data = [
                    'message' => 'OK',
                    'data' => $this->data,
                ];
                $this->data = json_encode($this->data);
                break;
            default:
                break;
        }
        
        echo $this->data;
    }
709493
public function successData($data, $msg = null, $extraData = [])
    {
        $return = $this->output(1, $msg, $data, $extraData);

        return $this->responseJson($return);
    }
1156489
public static function json( $data = array(), $status = 200, $beautify = true ) 
	{
		if ( !is_array( $data ) )
		{
			throw new CCException( "CCResponse::json - first argument has to be an array." );
		}

		$response = new static( CCJson::encode( $data, $beautify ), $status );
		$response->header( 'Content-Type', 'text/json' );

		return $response;
	}
979472
public function composeJson(array $data = [], int $status = 200, array $config = []): SymfonyResponse
    {
        return Response::make($this->createJsonResponse($data, $config)(), $status, [
            'Content-Type' => 'application/json',
        ]);
    }
84913
protected function getErrorResponse($msg, $errorCode, $statusText, $headers = [])
    {
        return $this->setStatusText($this->statusTexts[$statusText])
                    ->setStatusCode($statusText)
                    ->setStatusMessage(self::ERROR_TEXT)
                    ->setErrorCode($errorCode)
                    ->setErrorMessage($msg)
                    ->respondWithErrorMessage($headers);
    }
280488
private function respondWithJson(ResponseInterface $response, array $data, $status)
    {
        $body = $response->getBody();
        $body->rewind();
        $body->write(json_encode($data));

        $response = $response->withStatus($status);
        $response = $response->withHeader('Content-Type', 'application/json;charset=utf-8');

        return $response;
    }
779352
public static function json($data, $status = NULL) {
        if ($status) {
            parent::setStatus($status);
        }
        parent::setContentType('application/json');
        return json_encode($data);
    }
280249
private function handleMessage($messageData): \Generator
    {
        $messageType = implode('|', [
            ErrorResponse::class,
            ResultResponse::class,
            Notification::class,
            Request::class,
        ]);

        try {
            /** @var Message $message */
            $message = $this->mapper->load($messageData, $messageType);

            if ($message->jsonrpc !== Message::VERSION) {
                $this->logger->warning('[jsonrpc] Bad JSONRPC version received');
            }
        } catch (MapperException $e) {
            $this->logger->warning('[jsonrpc] Malformed message received');

            return new ErrorResponse(null, new InvalidRequestException());
        }

        if ($message instanceof Response) {
            return yield $this->handleResponse($message);
        }
        if ($message instanceof Request) {
            return yield $this->handleRequest($message);
        }
        if ($message instanceof Notification) {
            return yield $this->handleNotification($message);
        }

        throw new \LogicException(); // @codeCoverageIgnore
    }
576214
public static function json($mData, $bPretty = FALSE) {
		$iArg = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
		if ($bPretty) {
			$iArg = $iArg | JSON_PRETTY_PRINT;
		}
		return json_encode($mData, $iArg);
	}
802814
public static function responseJsonError($mdata = array(), $status = null, $msg = '', array $headers = array(), $options = 0)
    {
        $response = self::responseError($mdata, $status, $msg);

        return Response::json($response, $response['status'], $headers, $options);
    }