title: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)?
body: <p>test.py :  </p>
  
  <pre><code>from hello import Put
  
          put_response = Put.put_device_save()
          rest_api_response = json.loads(put_response)['Device']['Name']['Value']
          socket_resp = json.loads(SocketIO.ssc('{"device":{"name":":null}}', "123.456.57.186"))['device']['name']
  </code></pre>
  
  <p>hello.py</p>
  
  <pre><code>class Put():     
       def put_device_save(self, device_instance_id, url):
              payload = [{"InstanceId": 12, "Device":{"Name":{"Value":"test"}}}]
              self.connect_ssc("http://localhost:1010/api/devices/save", payload)
              response = self.connect_ssc("GET", "http://localhost:1010/api/devices/all")
              return response
  </code></pre>
  
  <p><strong>connect_ssc</strong> function :</p>
  
  <pre><code>def connect_ssc(self, method, url, body=None):
  
      token = self.generate_token()
      conn = http.client.HTTPConnection("localhost:1010")
  
      headers = {
          'accept': "application/json",
          'authorization': token,
          'content-type': "application/json",
          'cache-control': "no-cache",
      }
      time.sleep(5)
      # conn.request("GET", "/api/devices/all", payload, headers)
      conn.request(method, url, body, headers)
      try:
          res = conn.getresponse()
          data = res.read().decode("utf-8")
          return data
      except Exception as e:
          assert False, str(e)
  
  
  token_used_counter = 0
  token_starter = datetime.now()
  expiry = token_starter + timedelta(minutes=30)
  </code></pre>
  
  <p><strong>ssc</strong> function : </p>
  
  <pre><code>def ssc(command, ip, port=6970, timeout=1, buffer=1024):
  
      if isinstance(ip, str):
          ip_list = [ip]
      elif isinstance(ip, (list, tuple)):
          ip_list = ip
      else:
          raise TypeError('IPs must be strings or list/tuple of strings!')
  
      # Open Socket
      try:
          s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
          s.settimeout(timeout)
          reply = None
          retry_count = 0
          for current_ip in ip_list:
              while reply is None and retry_count &lt; 3:
                  try:
                      s.sendto(command.encode('utf-8'), (current_ip, port))
                  except:
                      print('Could not send {} to {} on Port {}.'.format(repr(command), current_ip, port))
                  else:
                      print('Sent: SSC command {} to {} on Port {}.'.format(repr(command), current_ip, port))
                      try:
                          d = s.recvfrom(buffer)
                      except socket.error:
                          print('No Reply from {}'.format(current_ip))
                      else:
                          reply = d[0].decode('utf-8')
                          ip_reply = d[1][0]
                          port_reply = d[1][1]
                          print('Received: {} from {} on port {}'.format(repr(reply), ip_reply, port_reply))
                      retry_count += 1
  
          return str(reply)
      finally:
          s.close()
  </code></pre>
  
  <p>Stackrace error am getting :</p>
  
  <hr>
  
  <pre><code>C:\Python36\lib\json\__init__.py:354: in loads
      return _default_decoder.decode(s)
  C:\Python36\lib\json\decoder.py:339: in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  
  self = &lt;json.decoder.JSONDecoder object at 0x0000027AB5B27A20&gt;, s = 'None'
  idx = 0
  
      def raw_decode(self, s, idx=0):
          """Decode a JSON document from ``s`` (a ``str`` beginning with
              a JSON document) and return a 2-tuple of the Python
              representation and the index in ``s`` where the document ended.
  
              This can be used to decode a JSON document from a string that may
              have extraneous data at the end.
  
              """
          try:
              obj, end = self.scan_once(s, idx)
          except StopIteration as err:
  &gt;           raise JSONDecodeError("Expecting value", s, err.value) from None
  E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  
  C:\Python36\lib\json\decoder.py:357: JSONDecodeError
  </code></pre>
  
  <p>I'm getting error from         <strong>socket_resp = json.loads(SocketIO.ssc('{"device":{"name":":null}}', "123.456.57.186"))['device']['name']</strong> this line i feel.  The ssc function creating problem i think...please help me to solve this issue.</p>