title: Convert numpy type to python
body: <p>I have a list of dicts in the following form that I generate from pandas. I want to convert it to a json format.</p>
  
  <pre><code>list_val = [{1.0: 685}, {2.0: 8}]
  output = json.dumps(list_val)
  </code></pre>
  
  <p>However, json.dumps throws an error: TypeError: 685 is not JSON serializable</p>
  
  <p>I am guessing it's a type conversion issue from numpy to python(?).</p>
  
  <p>However, when I convert the values v of each dict in the array using np.int32(v) it still throws the error.</p>
  
  <p>EDIT: Here's the full code</p>
  
  <pre><code>            new = df[df[label] == label_new] 
              ks_dict = json.loads(content)
              ks_list = ks_dict['variables']
              freq_counts = []
  
              for ks_var in ks_list:
  
                      freq_var = dict()
                      freq_var["name"] = ks_var["name"]
                      ks_series = new[ks_var["name"]]
                      temp_df = ks_series.value_counts().to_dict()
                      freq_var["new"] = [{u: np.int32(v)} for (u, v) in temp_df.iteritems()]            
                      freq_counts.append(freq_var)
  
             out = json.dumps(freq_counts)
  </code></pre>