Get the JSON-encoded array or stdClass from the response body

@throws InvalidArgumentException
@return array|stdClass
774367
protected function getResponseBody() {
        $body = json_decode((string) $this->response->getBody());

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidArgumentException('The response body does not contain valid JSON data.');
        } else if (!is_array($body) && !($body instanceof stdClass)) {
            throw new InvalidArgumentException('The response body does not contain a valid JSON array / object.');
        }

        return $body;
    }
763699
public function getJSONObject(){
        $result = false;
        $responseHandler = new ResponseHandler();
        if(is_array($this->_lastResponse)){
            $result = $responseHandler->arrayToObject($this->_lastResponse['body']);
        }
        return $result;
    }
345262
function jsonSerialize(): \stdClass {
    $map = new \stdClass;
    $map->id = $this->getId();
    if (mb_strlen($authorEmail = $this->getAuthorEmail())) $map->author_email = $authorEmail;
    if (mb_strlen($authorName = $this->getAuthorName())) $map->author_name = $authorName;
    if (mb_strlen($committerEmail = $this->getCommitterEmail())) $map->committer_email = $committerEmail;
    if (mb_strlen($committerName = $this->getCommitterName())) $map->committer_name = $committerName;
    if (mb_strlen($message = $this->getMessage())) $map->message = $message;
    return $map;
  }
1017672
public function serialize()
    {
        $result = [
            'code' => $this->getCode(),
            'message' => $this->getMessage(),
            'errors' => $this->getErrors()
        ];

        $result['data'] = $this->getVariables();

        if ($result['data'] instanceof Traversable) {
            $result['data'] = ArrayUtils::iteratorToArray($result['data']);
        }

        if (null !== $this->jsonpCallback) {
            return $this->jsonpCallback . '(' . Json::encode($result) . ');';
        }

        return Json::encode($result);
    }
1098956
public function jsonSerialize()
    {
        ob_start();
        echo $this->renderSearchField();
        $field = ob_get_contents();
        ob_end_clean();

        $ag = ResponseAssetGroup::get();
        $assetsResponse = [];
        foreach ($ag->getAssetsToOutput() as $position => $assets) {
            foreach ($assets as $asset) {
                if (is_object($asset)) {
                    $assetsResponse[$asset->getAssetType()][] = $asset->getAssetURL();
                }
            }
        }

        return [
            'key' => $this->getKey(),
            'label' => $this->getDisplayName(),
            'element' => $field,
            'data' => $this->data,
            'assets' => $assetsResponse,
        ];
    }
164177
public function jsonSerialize()
    {
        $parameters = [];

        if ($this->accessToken) {
            $parameters['access_token'] = $this->accessToken;
        }

        if ($this->userId) {
            $parameters['user_id'] = $this->userId;
        }

        if ($this->entityId) {
            $parameters['entity_id'] = $this->entityId;
        }

        if ($this->expires) {
            $parameters['expires'] = $this->expires;
        }

        return $parameters;
    }
117950
function jsonSerialize(): \stdClass {
    return (object) [
      'branch' => $this->getBranch(),
      'head' => ($commit = $this->getCommit()) ? $commit->jsonSerialize() : null,
      'remotes' => array_map(function(GitRemote $item) { return $item->jsonSerialize(); }, $this->getRemotes()->getArrayCopy())
    ];
  }
1257040
public function getData()
    {
        if (isset($this->functions) || isset($this->constructor)) {
            $arguments = func_get_args();
            $functionData = '';

            if (empty($this->toAddress) && !empty($this->bytecode)) {
                $constructor = $this->constructor;

                if (count($arguments) < count($constructor['inputs'])) {
                    throw new InvalidArgumentException('Please make sure you have put all constructor params and callback.');
                }
                if (!isset($this->bytecode)) {
                    throw new \InvalidArgumentException('Please call bytecode($bytecode) before getData().');
                }
                $params = array_splice($arguments, 0, count($constructor['inputs']));
                $data = $this->ethabi->encodeParameters($constructor, $params);
                $functionData = $this->bytecode . Utils::stripZero($data);
            } else {
                $method = array_splice($arguments, 0, 1)[0];

                if (!is_string($method)) {
                    throw new InvalidArgumentException('Please make sure the method is string.');
                }
    
                $functions = [];
                foreach ($this->functions as $function) {
                    if ($function["name"] === $method) {
                        $functions[] = $function;
                    }
                };
                if (count($functions) < 1) {
                    throw new InvalidArgumentException('Please make sure the method exists.');
                }
    
                $params = $arguments;
                $data = "";
                $functionName = "";
                foreach ($functions as $function) {
                    if (count($arguments) !== count($function['inputs'])) {
                        continue;
                    }
                    try {
                        $data = $this->ethabi->encodeParameters($function, $params);
                        $functionName = Utils::jsonMethodToString($function);
                    } catch (InvalidArgumentException $e) {
                        continue;
                    }
                    break;
                }
                if (empty($data) || empty($functionName)) {
                    throw new InvalidArgumentException('Please make sure you have put all function params and callback.');
                }
                $functionSignature = $this->ethabi->encodeFunctionSignature($functionName);
                $functionData = Utils::stripZero($functionSignature) . Utils::stripZero($data);
            }
            return $functionData;
        }
    }
339047
public function jsonSerialize()
    {
        return array_filter(
            [
                'bcc' => $this->getBccSettings(),
                'bypass_list_management' => $this->getBypassListManagement(),
                'footer' => $this->getFooter(),
                'sandbox_mode' => $this->getSandboxMode(),
                'spam_check' => $this->getSpamCheck()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
292876
protected function decodeJSON($body)
    {
        $params = json_decode($body, true);

        if (!is_array($params) || (JSON_ERROR_NONE !== json_last_error())) {
            throw new \InvalidArgumentException('Invalid JSON data provided.');
        }

        return $params;
    }
359470
public function jsonSerialize()
    {
        $ret = new StdClass;
        foreach ($this->map as $key => $value) {
            $ret->$key = (bool)($this->source & $value);
        }
        return $ret;
    }
609016
public function toStdClass()
    {
        $this->_prepareData();
        $data = new stdClass();

        foreach ($this->toArray() as $key => $val) {
            $data->$key = $val;
        }

        return $data;
    }
1115126
public function getContent()
    {
        $json = new \stdClass();

        $json->isSuccess    = $this->isSuccess();
        $json->errorCode    = $this->getErrorCode();
        $json->errorMessage = $this->getErrorMessage();
        $json->data         = $this->content;

        return $json;
    }
98845
public function jsonSerialize() {
        $ret = new \stdClass();

        $ret->maxRecipients = $this->maxRecipients;
        $ret->priority = $this->priority;

        if (is_null($this->deliveryStartDateTime) === false) {
            $ret->deliveryStartDateTime = $this->deliveryStartDateTime->format("Y-m-d\TH:i:s");
        }

        if (is_null($this->compileStartDateTime) === false) {
            $ret->compileStartDateTime = $this->compileStartDateTime->format("Y-m-d\TH:i:s");
        }

        $ret->compileBeforeDeliveryStart = $this->compileBeforeDeliveryStart;
        $ret->allowMultipleDeliveries = $this->allowMultipleDeliveries;
        $ret->deliverImmediately = $this->deliverImmediately;
        $ret->deliveryFrequency = $this->deliveryFrequency;
        $ret->obeyDeliveryLimits = $this->obeyDeliveryLimits;

        return $ret;
    }
757244
public function jsonSerialize()
    {
        $copy = [];
        foreach ((array)$this as $key => $value) {
            if (!is_string($value)) {
                $element = $value->getElement();
                if (is_object($element)
                    and method_exists($element, 'name')
                    and $name = $element->name()
                ) {
                    $copy[$name] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value;
                }
                $copy[$key] = $value instanceof JsonSerializable ? $value->jsonSerialize() : $value;
            } else {
                $copy[$key] = $value;
            }
        }
        return $copy;
    }
889134
public function jsonSerialize() {
        $data = new stdClass();
        $vars = get_object_vars($this);

        foreach ($vars as $property => $value) {
            if ($value === null) {
                continue;
            }

            $data->{$property} = $value;
        }

        return $data;
    }
392256
public function jsonSerialize() {
        $ret = new \stdClass();
        $requiredTargetAttributes = array();
        $requiredTargetAttributes['requiredTargetAttributes'] = $this->requiredTargetAttributes;
        $ret->requiredTargetAttributes = $requiredTargetAttributes;
        $ret->targetAttributes = $this->targetAttributes;

        return $ret;
    }