title: TypeError: Object of type dict_values is not JSON serializable
body: <p>I've been working with Python and Requests module to get all of Irelands Covid data by location.
  I've ran into a problem were my dict which is getting the data from the API call is not able to be converted to JSON, which I want to show on a Pandas Dataframe</p>
  <p>Now, unfortunately the website for the API is limited and I have to use a for loop for each location to get the data for that area. Then when I do this, I push this to a dictionary thisdict[&quot;of that locations name&quot;]</p>
  <p>Then I try convert the all 25 Dicts that it creates to JSON</p>
  <pre><code>toJSON = json.dumps(thisdict.values())
  data = json.loads(toJSON)
  </code></pre>
  <p>Now this is where I get the error
  However, if I use the location of one of the places that I have created it will work but I want all the locations. Is this possible</p>
  <pre><code>toJSON = json.dumps(thisdict[&quot;Dublin&quot;])
  data = json.loads(toJSON)
  </code></pre>
  <p>I've Tried</p>
  <pre><code>toJSON = json.dumps(*thisdict)
  data = json.loads(toJSON)
  </code></pre>
  <p>AND</p>
  <pre><code>toJSON = json.dumps(list(thisdict.values())
  data = json.loads(toJSON)
  </code></pre>
  <p>Which I found here
  <a href="https://markhneedham.com/blog/2017/03/19/python-3-typeerror-object-type-dict_values-not-json-serializable/" rel="nofollow noreferrer">https://markhneedham.com/blog/2017/03/19/python-3-typeerror-object-type-dict_values-not-json-serializable/</a></p>
  <p>All Code is in this link
  <a href="https://replit.com/@MrGallen/GetC19ApiToCSVEveryCounty#main.py" rel="nofollow noreferrer">https://replit.com/@MrGallen/GetC19ApiToCSVEveryCounty#main.py</a></p>
  <pre><code> # to handle  data retrieval
  import requests
  # to manage json data
  import json
  # for pandas dataframes
  import pandas as pd
  
  counties = [&quot;Carlow&quot;, &quot;Cavan&quot;, &quot;Clare&quot;, &quot;Cork&quot;, &quot;Donegal&quot;, &quot;Dublin&quot;, &quot;Galway&quot;, &quot;Kerry&quot;, &quot;Kildare&quot;, &quot;Kilkenny&quot;, &quot;Laois&quot;, &quot;Leitrim&quot;, &quot;Limerick&quot;, &quot;Longford&quot;, &quot;Louth&quot;, &quot;Mayo&quot;, &quot;Meath&quot;, &quot;Monaghan&quot;, &quot;Offaly&quot;, &quot;Roscommon&quot;, &quot;Sligo&quot;, &quot;Tipperary&quot;, &quot;Waterford&quot;, &quot;Westmeath&quot;, &quot;Wexford&quot;, &quot;Wicklow&quot;]
  thisdict = {}
  for county in counties:
    url = &quot;https://services1.arcgis.com/eNO7HHeQ3rUcBllm/arcgis/rest/services/Covid19CountyStatisticsHPSCIreland/FeatureServer/0/query?where=CountyName%20%3D%20'&quot;+county+&quot;'&amp;outFields=CountyName,PopulationCensus16,TimeStamp,ConfirmedCovidCases,PopulationProportionCovidCases,ConfirmedCovidDeaths,ConfirmedCovidRecovered&amp;returnGeometry=false&amp;outSR=4326&amp;f=json&quot;
    r = requests.get(url, stream=True)
    #info = r.headers
    #print(info)
    r = r.json()
    r = r[&quot;features&quot;]
    thisdict[county] = r
  
  # decode json data into a dict object
  toJSON = json.dumps(thisdict)
  data = json.loads(toJSON)
  # in this dataset, the data to extract is under 'features'
  with open(&quot;sample.json&quot;, &quot;w&quot;) as outfile: 
      json.dump(data, outfile)
  
  df = pd.json_normalize(data)
  print(df.head(10))
  
  # Select a number of columns - all rows
  CD = df[['attributes.CountyName', 'attributes.TimeStamp', 'attributes.ConfirmedCovidCases']]
  
  print(CD) # DataFrame
  </code></pre>