Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Reading JSON file in Python

import json
# For reading json file
with open ('fruit.json', 'r') as myfile:
 data=myfile.read()
# Parsing json code
fruit_detail = json.loads(data)
# Output
print ("fruit name: " + str(fruit_detail['fruit']))
print ("fruit size: " + str(fruit_detail['size']))
print ("fruit color: " + str(fruit_detail['color']))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Reading #JSON #file #Python
ADD COMMENT
Topic
Name
8+6 =