title: How to extract data from Finnhub.io? (importing JSON to pandas dataframe)
body: <p>I am a beginner in any code language. </p>
  
  <p>I want to model and explore data from stock markets, so I tried importing from finnhub, as they suggest.</p>
  
  <pre><code>import requests
  import json
  r = requests.get('https://finnhub.io/api/v1/stock/candle?symbol=QQQ&amp;resolution=1&amp;from=1572651390&amp;to=1572910590&amp;token=bq1q5g')
  print(r.json())
  </code></pre>
  
  <p>I can't seem to be able to work with it. </p>
  
  <pre><code>#Manipulation dict to list
  type(r.json())
  QQQ = str(r.json())
  type(QQQ)
  QQQ_1 = json.loads(QQQ)
  </code></pre>
  
  <p>This message happens:
  JSONDecodeError: Expecting property name enclosed in double quotes. So reading other posts I tried this code, but it won't work.</p>
  
  <pre><code>QQQ.replace("\'", "\"")
  </code></pre>
  
  <p>I just want to build a simple dataframe... I tried json_normalize, but I have to do a pd.series on it to split it. There must be a simple way.</p>
  
  <p>TIA!</p>
  
  <p>My code</p>
  
  <pre><code>import pandas as pd
  from pandas import json_normalize
  
  #Import data
  import requests
  import json
  r = requests.get('https://finnhub.io/api/v1/stock/candle?symbol=QQQ&amp;resolution=1&amp;from=1572651390&amp;to=1572910590&amp;token=bq1qmlfrh5rd509cok5g')
  print(r.json())
  
  Out[248]: {'c': [198.89, 198.89, 198.8, 198.79, 198.84, 199.55, 199.62, 199.62, 199.63, 199.62, 199.6, 199.67, 199.66, 199.7, 199.78, 199.77, 199.76, 199.77, 199.8, 199.77, 199.75, 199.79, 199.74, 199.77, 199.75, 199.74, 199.76, 199.78, 199.75, 199.75, 199.75, 199.76, 199.75, 199.75, 199.74, 199.75, 199.8, 199.9, 199.85, 199.89, 199.92, 200, 199.95, 200, 200.01, 200.12, 200.1, 200.11, 200.14, 200.09, 200.05, 200.06, 200.06, 200.04, 200.02, 200.01,......etc
  
  #Manipulation dict to list
  type(r.json())
  QQQ = str(r.json())
  type(QQQ)
  
  Out[249]: str
  
  QQQ_1 = json.loads(QQQ)
  
  Out[250]:
  Traceback (most recent call last):
  
    File "&lt;ipython-input-250-ba3a93b0612e&gt;", line 1, in &lt;module&gt;
      QQQ_1 = json.loads(QQQ)
  
    File "C:\Users\Poste\anaconda3\lib\json\__init__.py", line 348, in loads
      return _default_decoder.decode(s)
  
    File "C:\Users\Poste\anaconda3\lib\json\decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  
    File "C:\Users\Poste\anaconda3\lib\json\decoder.py", line 353, in raw_decode
      obj, end = self.scan_once(s, idx)
  
  JSONDecodeError: Expecting property name enclosed in double quotes
  
  
  #Replacing quotes with double quotes
  QQQ.replace("\'", "\"")
  
  Out[251]: '{"c": [198.89, 198.89, ......etc
  
  QQQ_1 = json.loads(QQQ)
  Out[252]:
  Traceback (most recent call last):
  
    File "&lt;ipython-input-252-ba3a93b0612e&gt;", line 1, in &lt;module&gt;
      QQQ_1 = json.loads(QQQ)
  
    File "C:\Users\Poste\anaconda3\lib\json\__init__.py", line 348, in loads
      return _default_decoder.decode(s)
  
    File "C:\Users\Poste\anaconda3\lib\json\decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  
    File "C:\Users\Poste\anaconda3\lib\json\decoder.py", line 353, in raw_decode
      obj, end = self.scan_once(s, idx)
  
  JSONDecodeError: Expecting property name enclosed in double quotes
  </code></pre>