Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- import sys
- dataJson = '{"id":"file","value":"File","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"}]}}'
- data = json.loads(dataJson)
- for item in data["popup"]["menuitem"]:
- print(item.get('onclick'))
- #json compacter : https://jsonformatter.org/e8391c
- #pretty print json : print(json.dumps(data, indent=4, sort_keys=True))
Add Comment
Please, Sign In to add comment