I have big json file, about 500mb, like next:
[
{"title": "title1 here", "text": ["text1 here"]},
{"title": "title2 here", "text": ["text2 here"]},
{...
]
I'd like to make changes in titles and text. How can I do it? I decided to read titles and texts as strings and after save it to json format again. It's ok with reading and making changes:
f = open('test.json')
data = json.load(f)
for i in range(len(data)):
#print(data[i]['title'])
changedTitle = data[i]['title'].split()
changedText = data[i]['text']
shuffle(changedTitle)
shuffle(changedText)
changedTitle = " ".join(changedTitle)
changedText = " ".join(changedText)
print(changedTitle)
print(changedText)
So I got changedTitle and changedText in loop and have no idea how to construct json file from it. Please advice. Thanks.
I decided to read titles and texts as strings and after save it to json format again.