How to create json file in Python? #import the json module import json #create a dictionary which we can add to a json file dictionary ={ "name" : "sathiyajith", "rollno" : 56, "cgpa" : 8.6, "phonenumber" : "9976770500" } #open an object with following inputs: 'name_of_file.json', 'w' #dump the content fromt he dictionary into the outfile with open("sample.json", "w") as outfile: json.dump(dictionary, outfile) Curly hair, very fair, please share :)Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on Reddit (Opens in new window)Click to share on Telegram (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to email a link to a friend (Opens in new window) Subash Chandran 12th October 2021 Leave a Comment