Javascript Fetch API - How to save output to variable as an Object (not the Promise) : <p>Please, how can I save output of fetch to a variable - to be able to work with it as with an object?</p>

<p>Here is the code:</p>

<pre><code>var obj;
fetch("url", {
  method: "POST",
  body: JSON.stringify({
    "filterParameters": {
      "id": 12345678
    }
  }),
  headers: {"content-type": "application/json"},
  //credentials: 'include'
})
.then(res =&gt; res.json())
.then(console.log)
</code></pre>

<p>The final <code>console.log</code> will show an object. But when I tried to save it to variable <code>.then(res =&gt; obj = res.json())</code> than the <code>console.log(obj)</code> will not hold the Object, but the Promise. </p>

<p><a href="https://i.stack.imgur.com/zkHFn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zkHFn.png" alt="Console"></a></p>

<p>Any idea please, how to turn it into an Object saved in the variable?</p>
