Skip to content

Instantly share code, notes, and snippets.

@nimit2801
Created November 6, 2020 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nimit2801/ff9e12c81e6309df1fdc4b434fbb540c to your computer and use it in GitHub Desktop.
Save nimit2801/ff9e12c81e6309df1fdc4b434fbb540c to your computer and use it in GitHub Desktop.
This Gist helps you to use json as your database with python. Its basic but you can develop things on this!
import json
with open("person.json", "r") as json_read:
json_dict = json.load(json_read)
name = input("enter your name: ")
json_dict["name"] = name
print(json_dict["name"])
person_dict = json_dict
with open('person.json', 'w') as json_file:
json.dump(person_dict, json_file)
{"name": "zombie", "languages": ["English", "Fench"], "married": true, "age": 32}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment