protected static function decodeBody(array $res)
    {
        $format = isset($res['headers']['x-datasift-format'])
            ? $res['headers']['x-datasift-format']
            : $res['headers']['content-type'];
        $retval = array();

        if (strtolower($format) == 'json_new_line') {
            foreach (explode("\n", $res['body']) as $json_string) {
                $retval[] = json_decode($json_string, true);
            }
        } else {
            $retval = json_decode($res['body'], true);
        }

        return $retval;
    }