write dict to json python
import json
with open('result.json', 'w') as fp:
json.dump(sample, fp)
write dict to json python
import json
with open('result.json', 'w') as fp:
json.dump(sample, fp)
save a dict to json python
import json
with open('data.json', 'w') as fp:
json.dump(data, fp)
how to save dictionary to json in python
import json
# Data to be written
dictionary ={
"id": "04",
"name": "sunil",
"depatment": "HR"
}
# Serializing json
json_object = json.dumps(dictionary, indent = 4)
print(json_object)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us