python append json code example
Example 1: write dict to json python
import json
with open('result.json', 'w') as fp:
json.dump(sample, fp)
Example 2: add item to json file python
import json
with open('file.json', 'a') as outfile:
outfile.write(json.dumps(data))
outfile.write(",")
outfile.close()