title: Send Multi Notification to GCM using JSON
body: <p>I want to send multiple notifications to many registered devices at once using GCM, and I know that that can not be done using the plain text since it only can be used to send notification for one device at time. So instead I decided to make the HTTP body content using JSON and I managed to make the following string that represents the JSON object:</p>
  <pre><code>{ collapse_key : my_CollapseKey, data.message : myMessage,  registration_ids : [&quot;regid1&quot;,&quot;regid2&quot;,...] }
  </code></pre>
  <p>But whenever I send the request I get a 400 response which states Bad Request, and when I refer to the document of <a href="http://developer.android.com/google/gcm/gcm.html" rel="nofollow noreferrer">GCM Architectural Overview</a> it states that</p>
  <blockquote>
  <p>Response 400 Only applies for JSON requests. Indicates that the request could not be parsed as JSON, or it contained invalid fields (for instance, passing a string where a number was expected)</p>
  </blockquote>
  <p>Here is the snapshot from my web app developed in ASP.Net that I used to send the request:</p>
  <pre><code>request.ContentType = &quot;application/json&quot;
          request.Headers.Add(&quot;Authorization: key=My_Server_Key&quot;)
          request.Headers.Add(&quot;Sender: id=myProject_ID&quot;)
          Dim collapsKey = Guid.NewGuid.ToString(&quot;n&quot;)
          Dim data As String = &quot;{ collapse_key : &quot; + collapsKey + &quot;,&quot; + &quot; data.message : &quot; + HttpUtility.UrlEncode(TextBox1.Text) + &quot;}&quot; + &quot;, registration_ids : &quot; + jsonids1 + &quot;}&quot;
          Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
          request.ContentLength = byteArray.Length
          Dim dataStream As Stream = request.GetRequestStream
          dataStream.Write(byteArray, 0, byteArray.Length)
          dataStream.Close()
  </code></pre>
  <p>Any idea how I can parse my JSON object correctly and send multiple notifications?
  any help will be completely appreciated.</p>
  <p>regards</p>