title: How do you solve 'dict' object has no attribute 'write'?
body: <p>I haven't worked with JSON files before, and I think maybe I'm just a little lost on how to pull data in. Here's my code:</p>
  
  <pre><code># Loads data on women breastfeeding in America from the web # 
  import urllib.request
  import json 
  with urllib.request.urlopen("https://chronicdata.cdc.gov/views/8hxn-cvik/rows.json?accessType=DOWNLOAD") as web_data:
      data = json.loads(web_data.read().decode())
      json.dump(data, web_data)
  </code></pre>
  
  <p>I'm trying to pull in the data from the internet, as the link itself is a webpage view, and my computer refused to let me save it onto my computer. I want to be able to manipulate the data, but I've run into several problems. With the above code, I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  UnsupportedOperation                      Traceback (most recent call last)
  &lt;ipython-input-31-7f3487bc83ea&gt; in &lt;module&gt;()
        6     data = json.loads(web_data.read().decode())
        7     #write_data=data.write()
  ----&gt; 8     json.dump(data, web_data)
  
  ~\OneDrive\Documents\Python stuff\Pythonstuff\lib\json\__init__.py in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
      178     # a debuggability cost
      179     for chunk in iterable:
  --&gt; 180         fp.write(chunk)
      181 
      182 
  
  UnsupportedOperation: write
  </code></pre>
  
  <p>I tried the following, thinking it had something to do with the .read():</p>
  
  <pre><code>import urllib.request
  import json 
  with urllib.request.urlopen("https://chronicdata.cdc.gov/views/8hxn-cvik/rows.json?accessType=DOWNLOAD") as web_data:
      data = json.loads(web_data.read().decode())
      write_data=data.write()
      json.dump(write_data, web_data)
  </code></pre>
  
  <p>And then I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-32-7ce187449c36&gt; in &lt;module&gt;()
        5 with urllib.request.urlopen("https://chronicdata.cdc.gov/views/8hxn-cvik/rows.json?accessType=DOWNLOAD") as web_data:
        6     data = json.loads(web_data.read().decode())
  ----&gt; 7     write_data=data.write()
        8     json.dump(write_data, web_data)
  
  AttributeError: 'dict' object has no attribute 'write'
  </code></pre>
  
  <p>Can someone help point me in the right direction? I'm lost as to how I can open this file and start manipulating the data. I'll eventually want to be able to manipulate some things into a data frame from there.</p>