title: Not able to parse JSON (which is not nested JSON) object coming from socket in python
body: <p>New in python, I am reading JSON object from the server, size of JSON object is not fix. I am getting data from the server as per the buffer size given in socket.recv(1024). How to check that JSON object from server-socket received is full/complete, Because while parsing that JSON I am getting an error.
  Please note that my JSON object is not nested.</p>
  
  <p>**** Sample code ****</p>
  
  <pre><code>def get_data():
      s = socket.socket()
      host = 'IP_Address'
      port = 'Port_Number'
  
      # connection to hostname on the port.
      s.connect((host, port))
      msg=''
      while(True):        
          msg = s.recv(1024)
          print(msg.decode('ascii'))   
          jsonObject=json.loads(msg.decode('ascii'))     
  
      s.close()    
  </code></pre>
  
  <p>Below is the error </p>
  
  <pre><code>Traceback (most recent call last):
  
    File "d:/xxxxxxxxxxxxx/Python_Test.py", line 26, in &lt;module&gt;
      get_data()
  
    File "d:/xxxxxxxxxxxxx/Python_Test.py", line 20, in get_data
      temp=json.loads(msg.decode('ascii'))
  
    File "xxxxxxxxxxxxx\Python\Python37\lib\json\__init__.py", line 348, in loads
      return _default_decoder.decode(s)
  
    File "xxxxxxxxxxxxx\Python\Python37\lib\json\decoder.py", line 340, in decode
      raise JSONDecodeError("Extra data", s, end)
  
  json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 777)
  </code></pre>