Google Apps Script UrlFetchApp isn't encoding a JSON array correctly
<p>I've looked everywhere and can't find this issue. I've come over from PeopleSoft to .NET and have only recently began learning JavaScript and I'm attempting to use Google Apps Script to send email notification messages to Slack. </p>

<p>It appears to me that GAS's UrlFetchApp isn't handling an array correctly. Below I didn't include all the Slack API options for clarity.  Here how I constructed the payload, where 'attachments' contains the array in question:</p>

<pre><code>var payload = 
      {
       // ...
        "username": "Test webhook Bot", 
        "attachments": [
          {
            "pretext": "pre-hello1", 
            "text": "text-world1"
          },
          {
            "pretext": "pre-hello2", 
            "text": "text-world2"
          }
        ]        
        //  ...        
      };


 var options = 
      {
        "method" : "post",
        "payload" : payload,
        "contentType":"application/json"
      };

var response = UrlFetchApp.fetch(requestURL, options); 
</code></pre>

<p>When testing I found that the post was occuring but Slack was ignoring the attachments portion of the message. I used the following to examine the outgoing POST:</p>

<pre><code>    var response = UrlFetchApp.getRequest(requestURL, options);
</code></pre>

<p>And what I found looking at the execution transcript I find that the JSON array in my  payload isn't being encoded the way I expected. Before execution, I clearly see the properly formatted array.</p>

<blockquote>
  <p>[16-01-26 07:26:39:050 MST] UrlFetchApp.getRequest([<a href="https://slack.com/api/chat.postMessage" rel="nofollow">https://slack.com/api/chat.postMessage</a>?, {method=post, payload={attachments=[{pretext=pre-hello1, text=text-world1}, {pretext=pre-hello2, text=text-world2}], username=Test webhook Bot}, contentType=application/json}]) [0 seconds]</p>
</blockquote>

<p>But what is actually sent, in place of the attachments array is: <em>%5BLjava.lang.Object;@37f01fb3</em></p>

<blockquote>
  <p>[16-01-26 07:26:39:051 MST] Logger.log([Test:<a href="https://slack.com/api/chat.postMessage?attachments=%5BLjava.lang.Object;@37f01fb3&amp;username=Test+webhook+Bot" rel="nofollow">https://slack.com/api/chat.postMessage?attachments=%5BLjava.lang.Object;@37f01fb3&amp;username=Test+webhook+Bot</a>, []]) [0 seconds]</p>
</blockquote>

<p>I tried searching this out as much as I could before asking for help, but I'm not sure if I'm either loss.  Does anyone know where I may look to find out what I'm missing? Thanks.</p>