private function interpretResponseJSON()
    {
        $this->debug_echo("\n\nResponse (json):\n");
        $this->debug_print_r($this->state['response']['body_raw']);

        // Convert response from json to array format if required
        if ($this->config['dataFormat'] == 'array') {
            try {
                $this->state['response']['body'] = json_decode(
                    $this->state['response']['body_raw'],
                    true
                ); 
            } catch (Exception $e) {
                $msg = 'Invalid response body from API: '.$this->state['response']['body_raw']
                     . '(HTTP response code was '.$this->state['response']['code'].')';
                throw new ApiException($msg, $this->state);
            }
            $this->debug_echo("\n\nResponse (array):\n"); 
            $this->debug_print_r($this->state['response']['body']); 
        } else {
            $this->state['response']['body'] = $this->state['response']['body_raw'];
        }

        if ($this->state['response']['code'] < 200 ||
            $this->state['response']['code'] >= 300
        ) {
            $this->handleHttpError();
        }

        return $this->state;
    }
private function interpretResponseJSON()
    {
        $this->debug_echo("\n\nResponse (json):\n");
        $this->debug_print_r($this->state['response']['body_raw']);

        // Convert response from json to array format if required
        if ($this->config['dataFormat'] == 'array') {
            try {
                $this->state['response']['body'] = json_decode(
                    $this->state['response']['body_raw'],
                    true
                ); 
            } catch (Exception $e) {
                $msg = 'Invalid response body from API: '.$this->state['response']['body_raw']
                     . '(HTTP response code was '.$this->state['response']['code'].')';
                throw new ApiException($msg, $this->state);
            }
            $this->debug_echo("\n\nResponse (array):\n"); 
            $this->debug_print_r($this->state['response']['body']); 
        } else {
            $this->state['response']['body'] = $this->state['response']['body_raw'];
        }

        if ($this->state['response']['code'] < 200 ||
            $this->state['response']['code'] >= 300
        ) {
            $this->handleHttpError();
        }

        return $this->state;
    }
private function interpretResponseJSON ( ) { $ this -> debug_echo ( "\n\nResponse (json):\n" ) ; $ this -> debug_print_r ( $ this -> state [ 'response' ] [ 'body_raw' ] ) ; // Convert response from json to array format if required if ( $ this -> config [ 'dataFormat' ] == 'array' ) { try { $ this -> state [ 'response' ] [ 'body' ] = json_decode ( $ this -> state [ 'response' ] [ 'body_raw' ] , true ) ; } catch ( Exception $ e ) { $ msg = 'Invalid response body from API: ' . $ this -> state [ 'response' ] [ 'body_raw' ] . '(HTTP response code was ' . $ this -> state [ 'response' ] [ 'code' ] . ')' ; throw new ApiException ( $ msg , $ this -> state ) ; } $ this -> debug_echo ( "\n\nResponse (array):\n" ) ; $ this -> debug_print_r ( $ this -> state [ 'response' ] [ 'body' ] ) ; } else { $ this -> state [ 'response' ] [ 'body' ] = $ this -> state [ 'response' ] [ 'body_raw' ] ; } if ( $ this -> state [ 'response' ] [ 'code' ] < 200 || $ this -> state [ 'response' ] [ 'code' ] >= 300 ) { $ this -> handleHttpError ( ) ; } return $ this -> state ; }
Process a JSON CURL response.

@return mixed API response. The format depends on dataFormat.

@throws MyAllocator\phpsdk\src\Exception\ApiException
Process a JSON CURL response .