Answers for "read a json string in python"

14

python read json

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)
Posted by: Guest on March-24-2021
66

python read json file

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)

print(data)
Posted by: Guest on April-08-2020
0

how to read json from python

#this code helps translate JSON file
#to a dictionary

import json

person = '{"name": "Bob", "languages": ["English", "Fench"]}'
person_dict = json.loads(person)

print( person_dict)

print(person_dict['languages'])
Posted by: Guest on September-30-2021
1

json load

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)

# Output: {'name': 'Bob', 'languages': ['English', 'Fench']}
print(data)
Posted by: Guest on October-27-2020

Python Answers by Framework

Browse Popular Code Answers by Language