I have a big JSON file (exported via Azure Data Factory). If DataFactory finds an issue it adds $ signs between objects. For example, it looks like this:
<br>{...}<br> {...}<br> {...}${...}<br> So I have an error for example json.decoder.JSONDecodeError: Extra data: line 1 column 21994 (char 21993)
I was dealing with it in an easy way - notepad++ replacing $ to \n and it was good ;) but now my file is about 1.3 GB and I didn't have a tool to edit such a big file.
I use python to export data from all JSON objects in the file and export them to XMLs.
Now I'm looking for some solution to replace all of the $ signs to newlines \n and clean the file.
The beginning of my code is:
a = open('test.json', 'r', encoding = 'UTF8') data1 = a.readlines() a.close() for i in range(len(data1)): print('Done%d/%d'%(i,len(data1))) jsI = json.loads(data1[i]) and there if file occurs to $ sign it is over.
May I ask for some advice on how to replace $ signs with newlines in a file using Python?