title: Fetch: POST JSON data
body: <p>I'm trying to POST a JSON object using <a href="https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch" rel="noreferrer">fetch</a>.</p>
  <p>From what I can understand, I need to attach a stringified object to the body of the request, e.g.:</p>
  <pre class="lang-js prettyprint-override"><code>fetch(&quot;/echo/json/&quot;,
  {
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      method: &quot;POST&quot;,
      body: JSON.stringify({a: 1, b: 2})
  })
  .then(function(res){ console.log(res) })
  .catch(function(res){ console.log(res) })
  </code></pre>
  <p>When using <a href="https://jsfiddle.net/abbpbah4/" rel="noreferrer">jsfiddle's JSON echo</a> I'd expect to see the object I've sent (<code>{a: 1, b: 2}</code>) back, but this does not happen - chrome devtools doesn't even show the JSON as part of the request, which means that it's not being sent.</p>