public function parseJson($body)
    {
        if ($body instanceof ResponseInterface) {
            $body = $body->getBody();
        }

        if ($body instanceof StreamInterface) {
            $body = $body->getContents();
        }

        if (empty($body)) {
            return false;
        }

        $contents = json_decode($body, true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new Exception('Failed to parse JSON: '.json_last_error_msg());
        }

        return $contents;
    }
public function parseJson($body)
    {
        if ($body instanceof ResponseInterface) {
            $body = $body->getBody();
        }

        if ($body instanceof StreamInterface) {
            $body = $body->getContents();
        }

        if (empty($body)) {
            return false;
        }

        $contents = json_decode($body, true);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new Exception('Failed to parse JSON: '.json_last_error_msg());
        }

        return $contents;
    }
@param \Psr\Http\Message\ResponseInterface|string $body

@return array

@throws \Exception