Answers for "how to print json file in python"

0

dump json in file python

with open('data.txt', 'w') as f:
    json.dump(jsonData, f)
Posted by: Guest on June-15-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
4

python json.dumps pretty print

json.dumps(x, indent=4)
Posted by: Guest on September-23-2020
3

python format json file

python3 -m json.tool unformatted.json > formatted.json
Posted by: Guest on June-09-2020

Code answers related to "how to print json file in python"

Code answers related to "Javascript"

Browse Popular Code Answers by Language