Answers for "python load json data into file"

1

python object to json file

data = {
  "your json": "has data!"
}

with open('data.txt', 'w') as outfile:
    json.dump(data, outfile)
Posted by: Guest on October-06-2021
2

how to print a json file in python

# Python program to read 
# json file 
  
  
import json 
  
# Opening JSON file 
f = open('data.json',) 
  
# returns JSON object as  
# a dictionary 
data = json.load(f) 
  
# Iterating through the json 
# list 
for i in data['emp_details']: 
    print(i) 
  
# Closing file 
f.close()
Posted by: Guest on December-11-2020

Code answers related to "python load json data into file"

Python Answers by Framework

Browse Popular Code Answers by Language