Get json raw body data
@author Adeyemi Olaoye <yemi@cottacush.com>
@param bool|false $assoc
@return array|bool|stdClass
5070
public function getPostData($assoc = false)
    {
        $postData = $this->request->getJsonRawBody($assoc);

        if (!is_object($postData) && !$assoc) {
            return new stdClass();
        }

        if (!is_array($postData) && $assoc) {
            return [];
        }

        return $postData;
    }
562901
public function paramsToString(array $params, $assoc = true)
    {
        $string = [];
        foreach ($params as $key => $param) {
            if (is_array($param)) {
                $string[] = $assoc
                    ? $key . '=' . $this->paramsToString($param, isAssocArray($param))
                    : $this->paramsToString($param, isAssocArray($param));
            } else {
                $string[] = $assoc ? $key . '=' . $param : $param;
            }
        }
        return join('&', $string);
    }
1355744
public function getData($assoc = false, $depth = 512, $options = 0)
	{
		return json_decode($this->data, $assoc, $depth, $options);
	}
705995
public static function decode($json, $assoc = false)
    {
        if ($json instanceof Response) {
            return json_decode($json->getContent(), $assoc);
        }

        return json_decode($json, $assoc);
    }
871890
private function decodeJson($input, $assoc = false)
    {
        $input = trim($input);

        return json_decode($input, $assoc);
    }
1276095
public function getResponseBody($decode = true)
    {
        $data = $this->response->getBody();
        return $decode === true ? json_decode($data) : $data;
    }
75173
static function json_parse($json = '', $assoc = false, $depth = 512)
    {

        $parsed = \json_decode($json, $assoc, $depth);

        //if (JSON_ERROR_NONE !== json_last_error()) {
        //    throw new \RuntimeException('JSON Error: Unable to parse into JSON: ' . json_last_error());
        //}

        $error = json_last_error();

        switch ($error) {
            case JSON_ERROR_NONE:
                break;
            case JSON_ERROR_DEPTH:
                throw new InvalidArgumentException('JSON Error: Maximum stack depth exceeded');
                break;
            case JSON_ERROR_CTRL_CHAR:
                throw new InvalidArgumentException('JSON Error: Unexpected control character found');
                break;
            case JSON_ERROR_SYNTAX:
                throw new InvalidArgumentException('JSON Error: Syntax error, malformed JSON');
                break;
            default:
                throw new InvalidArgumentException('JSON Error: Unknown error');
                break;
        }

        // This is a courtesy by PHP JSON parser to parse "null" into null, but this is an error situation
        if (empty($parsed)) {
            throw new InvalidArgumentException('JSON Error: Result is empty after parsing');
        }

        return $parsed;

    }
159083
public function decode(string $json, bool $assoc = null, int $depth = null, int $options = null)
    {
        list($content, $error) = $this->softDecode($json, $assoc, $depth, $options);
        if ($error !== null) {
            throw $error;
        }
        return $content;
    }
1333286
public function getJson()
    {
        if (stripos($this->getHeader('content-type'), '/json') !== false) {
            return json_decode($this->body, true);
        } else {
            return false;
        }
    }
875437
public static function decode($json, $assoc = FALSE)
  {
    $json = utf8_encode($json);
    $json = str_replace(array("\n","\r"),"",$json);
    $json = preg_replace('/([{,])(\s*)([^"]+?)\s*:/','$1"$3":',$json);
    return json_decode($json,$assoc);
  }
219095
public static function decode($string, $assoc = true)
    {
        $result = self::decodeRecursive($string, $assoc);
        return $result[0];
    }
799057
public static function decode(string $data, bool $assoc = false, int $depth = 512, int $options = 0)
    {
        $json          = json_decode($data, $assoc, $depth, $options);
        $jsonLastError = json_last_error();

        if ($jsonLastError !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException('Failed to decode JSON: ' . json_last_error_msg(), $jsonLastError);
        }

        return $json;
    }
559313
public function getDataMeta( $model, $key, $assoc = false ) {

		$object	= $model->generateDataObjectFromJson( $assoc );
		$meta	= new Meta();

		if( isset( $object->$key ) ) {

			$meta->key		= $key;
			$meta->value	= $object->$key;

			return $meta;
		}

		return false;
	}
1372398
public function get($object)
	{
		if ($this->oauth != null)
		{
			if ($this->oauth->isAuthenticated())
			{
				$response = $this->oauth->query($this->fetchUrl($object));

				return json_decode($response->body);
			}
			else
			{
				return false;
			}
		}

		// Send the request.
		return $this->sendRequest($object);
	}
571305
public function toJson($options = 0, $structure, $assoc = true)
    {
        return json_encode(
            $this->toOutput($structure, $assoc),
            $options
        );
    }
543302
public function json($assoc = false, $fromEncoding = null, $toEncoding = 'UTF-8')
    {
        return json_decode($this->body($fromEncoding, $toEncoding), $assoc);
    }
382878
public function headers($assoc = false)
    {
        if (!$assoc) {
            return $this->headers;
        }
        
        return $this->prettifyHeaders($this->headers);
    }