I have a simple code to add a string s to the beginning of each line of a very big JSON file with 3m records..the problem is that it is done for the only 4430 first records and the rest in deleted from output.this is the code:
s = '{ "index" : { "_index" : "gg2", "_type" : "log"} }'
with open('final.json', 'w') as out_file:
with open('K2.2.json', 'r') as in_file:
for line in in_file:
out_file.write(s + '\n' + line.rstrip('\n') + '\n')
Do you have any ideas why this is happening?