title: Javascript: Converting URL containing JSON into traversable variable?
body: <p>Javascript: If I have a url that has contents that are just in JSON, how do I go from the url to having the JSON stored in a variable that I can traverse and get certain values from?</p>
  
  <p>For example the url might contain something like this and nothing else: </p>
  
  <pre><code>{"cookies": [ {"chocolate": 50}, {"raisin": 12} ]  }
  </code></pre>
  
  <p>How might I extract the contents of the URL to have the object that I can assign the contents to a variable, say x, and then use functions like x.cookies to get   [ {"chocolate": 50}, {"raisin": 12} ]  }?? </p>
  
  <p>Thanks so much! I greatly appreciate your help :) Have a great day!</p>