Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- # more at: https://docs.python.org/3/library/json.html
- jsonFile = '''{
- "people":[
- {
- "name" :"riju",
- "university" : "EWU",
- "progession":"full-stack developer",
- "phone":"0193-7",
- "email":["[email protected]","[email protected]"]
- },
- {
- "name" :"alen",
- "university" : "NSU",
- "progession":"data-scientist",
- "phone":"0188-1",
- "email":null
- }
- ]
- }
- '''
- dataLoad = json.loads(jsonFile)
- print(dataLoad)
- print('\n')
- # get specific data
- for people in dataLoad['people']:
- # only email
- print(people['email'])
- print('\n')
- # 2nd para:to make a nice format,3rd: ascending
- dump = json.dumps(dataLoad, indent=2, sort_keys=True)
- print(dump)
Advertisement
Add Comment
Please, Sign In to add comment