title: Saving Json data to Sqlite Python
body: <p>I am trying to save my Json data that I have pulled from a URL, but I am struggling to save it in an SQLite database.</p>
  
  <p>Json:</p>
  
  <p>{"Address":"ff00000a70d57128","Celsius":26.8125,"Fahrenheit":80.2625}</p>
  
  <p>I have looked around and gained from inspiration from:</p>
  
  <p><a href="https://stackoverflow.com/questions/34966712/saving-json-data-into-sqlite">saving json data into sqlite</a>
  <a href="https://stackoverflow.com/questions/8811783/convert-json-to-sqlite-in-python-how-to-map-json-keys-to-database-columns-prop">Convert JSON to SQLite in Python - How to map json keys to database columns properly?</a></p>
  
  <pre class="lang-py prettyprint-override"><code>import threading
  import json
  import urllib.request
  import sqlite3
  
  def tempRequest():
      # download raw json object
      url = "http://10.0.0.111:8080/getdevice?device=type28_1"
      data = urllib.request.urlopen(url).read().decode()
  
      # parse json object
      obj = json.loads(data)
      print(obj)
  
  tempRequest()
  
  conn = sqlite3.connect('test.db')
  c = conn.cursor()
  
  def create_table():
      c.execute("CREATE TABLE IF NOT EXISTS data(Celcius TEXT)")
  
  def data_entry():
      c.executemany('INSERT INTO data (Celcius) ''VALUES (:Celcius)
  
      conn.commit()
      c.close()
      conn.close()
  
  create_table()
  data_entry()
  </code></pre>
  
  <p>What i get when i am running this is:</p>
  
  <p>TypeError(f'the JSON object must be str, bytes or bytearray, '
  TypeError: the JSON object must be str, bytes or bytearray, not ellipsis</p>
  
  <p>I have tried to change:</p>
  
  <pre class="lang-py prettyprint-override"><code>obj = json.loads(data)
  </code></pre>
  
  <p>to</p>
  
  <pre class="lang-py prettyprint-override"><code>obj = json.loads(str(data))
  </code></pre>
  
  <p>But i think that the issue is on how i handle the DB part, any advice would be much appreciated.
  Thanks!</p>