Answers for "import json in file"

17

open json file python

import json

with open('data.txt') as json_file:
    data = json.load(json_file)
Posted by: Guest on March-02-2020
3

read json file

# Python program to read JSON
# from a file
  
  
import json
  
# Opening JSON file
with open('sample.json', 'r') as openfile:
  
    # Reading from json file
    json_object = json.load(openfile)
  
print(json_object)
print(type(json_object))
Posted by: Guest on January-08-2022

Python Answers by Framework

Browse Popular Code Answers by Language