To make suggestions click here

Project News

Installation

<aside> 🔄 pip install edit-json-file or pip3 install edit-json-file

</aside>

Open a json file

from edit_json_ile import * # Import modules
editJsonFile.open("file.json") # Open the file 'file.json'

Edit and save a json file

from edit_json_file import * # Import modules
editJsonFile.open("file.json") # Open the file 'file.json'
editJsonFile.edit("file.json", "value", "key") # Set the value of the key 'key' to 'value'
# Same thing but with multiple key:
editJsonFile.edit("file.json", "value", "user", "name") # Set the value of the key 'name' inside 'user' to 'value'
editJsonFile.save("file.json") # Save the file 'file.json'

Get the value of a key

from edit_json_file import * # Import modules
editJsonFile.open("file.json") # Open the file 'file.json'
print(editJsonFile.get("file.json", "key")) # Print the value of the key 'key'
# Same thing but with multiple key:
print(editJsonFile.get("file.json", "user", "name")) # Print the value of the key 'name' inside 'user'