Sunday, November 15, 2015

Reading Json files

Reading Json files we need json module....

import json
with open('Sample.json', "r") as data_file:  
    data = json.load(data_file)
print(data["id"])
print(data["name"])
print(data["price"])
print(data["tags"])

Output will be like this:

1
A green door
12.5

[u'home', u'green']



If you still got any Q's for me feel free to comment will be happy to respond ..
Thanks your support...
MS

No comments:

Post a Comment