#Dumping JSON data in a text file result = [] data = {} #data['Customer_profile']=[] #data2 = json.load(open('data_in_auth.json')) fo = open("data_in_custProfile.json", "w") for item in json_decode: my_dict = {} my_dict['Email'] = item.get('email') my_dict['Cid'] = item.get('Cid') my_dict['Password'] = item.get('password') #result.append(my_dict) #for i in range(0,5): #Cid="'%s'"%(fake.CustomerCode()) my_dict['F_name'] = "'%s'" % (fake.first_name()) my_dict['L_name'] = "'%s'" % (fake.last_name()) my_dict['Age'] = "'%s'" % (fake.random_int(min=13, max=67)) my_dict['Address'] = "'%s'" % (fake.address()) #email="'%s'"%(fake.email()) #password="******"%(fake.password()) my_dict['mobile_no'] = "'%s'" % (fake.phone_number()) my_dict['user_category'] = "'%s'" % (fake.CustomerCategory()) #result.append({'F_name': first_name, 'L_name': last_name, 'Age': age, 'Address': address, 'mobile_no': mobile_no, 'user_category': user_category}) #data2.update(data) result.append(my_dict) json_data = json.dumps(result) fo.write(json_data) fo.close()