I need to open a json file and add content to it and close it without modifying the previous content. I am loading a file from a .json extension using json.loads() and with open() but when I do that and reprint to next json file including the content that I got from the first file, all floats ARE cut the empty decimal places.
E.G.:
Original json file:
{'lat' : 3.546700,
'lon' : 6.000000}
After loading the file on python and reprinting adding altitude the new json file looks like this:
{'lat' : 3.5467,
'lon' : 6.0
'alt' : 3.467878}
The ideal output would be this;
{'lat' : 3.546700,
'lon' : 6.000000
'alt' : 3.467878}
P.D. this is recursive it means that I can't go field by field doing this '{:10.6f}'.format(a), this script is processing more than 100 json files.