title: How to assign a value from JSON to a variable in javascript
body: <p>I am using the CheckPoint API in my web app and I am trying to store the "sid" in a variable.
  How can I do this? 
  Below is the code snippet that I use to login</p>
  
  <pre><code>var myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/json");
  
  var raw = JSON.stringify({ user: "Licenta2020", password: "Licenta2020" });
  
  var requestOptions = {
    method: "POST",
    headers: myHeaders,
    body: raw,
    redirect: "follow",
  };
  fetch("https://192.168.100.100/web_api/v1.6/login", requestOptions)
    .then((response) =&gt; response.text())
    .then((result) =&gt; {
      console.log(result);
    })
    .catch((error) =&gt; console.log("error", error));
  </code></pre>
  
  <p>And here is the result of this request, I want to take the sid value and assign to a variable so I can use it later on for other requests.</p>
  
  <pre><code>{
    "uid" : "4a587f4b-6a0a-4e0f-a1f4-cb99b19657dd",
    "sid" : "ite95YKJ7gmV-7s4YJbHIeAke9ODoklA5Z1yVHriRkA",
    "url" : "https://192.168.100.100:443/web_api/v1.6",
    "session-timeout" : 600,
    "last-login-was-at" : {
      "posix" : 1591398092564,
      "iso-8601" : "2020-06-06T02:01+0300"
    },
    "disk-space-message" : "Partition /var/log has: 1354 MB of free space and it's lower than required: 2000 MB\n",
    "api-server-version" : "1.6"
  }
  </code></pre>
  
  <p>Tried this code snippet too</p>
  
  <pre><code>.then((result) =&gt; {
      let sid = result.sid;
      console.log(result);
      console.log(sid);
    })
  </code></pre>