Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

edit json file python

import json

with open('data.json', 'r+') as f:
    data = json.load(f)
    data['id'] = 134 # <--- add `id` value.
    f.seek(0)        # <--- should reset file position to the beginning.
    json.dump(data, f, indent=4)
    f.truncate()     # remove remaining part
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #edit #json #file #python
ADD COMMENT
Topic
Name
1+1 =