title: How to fix this error json.decoder.JSONDecodeError: Python
body: <p>could someone tell me please why this code works only one time and in the second time i get an error 
  <strong>My code:</strong></p>
  
  <pre><code>import json
  
  counter_value = 1
  data= {}
  data['test_device']= []
  data['test_device'].append({ "device": "gas_zaehler", "measure": "energy","value": counter_value})
  
  with open('test.json', 'a') as feedjson:
      json.dump(data, feedjson)
      feedjson.write('\n')
      feedjson.close()
  
  with open('test.json') as feedjson:
      json_data = json.load(feedjson)
  for i in json_data['test_device']:
      print("device" + i['device'] )
  </code></pre>
  
  <p>in the second time execution i got this <strong>error</strong>:</p>
  
  <pre><code>  File "/usr/lib/python3.5/json/decoder.py", line 342, in decode
      raise JSONDecodeError("Extra data", s, end)
  json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 78)
  </code></pre>
  
  <p>its not the same Issue as this link bellow, because i don't have two dictionnaries{}{}:
  <a href="https://stackoverflow.com/questions/21058935/python-json-loads-shows-valueerror-extra-data">Python json.loads shows ValueError: Extra data</a></p>