I've got a array saved in a json file looking like this [4.810,-75.700,0.020,11,5.070,-75.520,0.010,11]. I'm using Python to append new 4-tuples to this array.
globe_list = [18.110,-66.170,0.000,11]
json_array = json.dumps(globe_list)
with open(webgl_file_path + 'tweet_locations.json', 'a') as tf:
tf.write(json_array)
The problem is, when the file already exists, what I get after the appending is two arrays:
[4.810,-75.700,0.020,11,5.070,-75.520,0.010,11][18.110,-66.170,0.000,11]
Whereas what I want is one array:
[4.810,-75.700,0.020,11,5.070,-75.520,0.010,11, 18.110,-66.170,0.000,11]
If I would load the json array in a list first a could just extend it, but the file is huge and I'm worrying performance issues. Is there a simple way to do this?
Thanks in advance.