Skip to main content

writing json to a file using python

import json
data={}
data['people']=[]
data['people'].append({'name':'Ram Singh'});
with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)

Comments