1import json
2
3studentJson ="""{
4 "id": 1,
5 "name": "john wick",
6 "class": 8,
7 "percentage": 75,
8 "email": "jhon@pynative.com"
9}"""
10
11print("Checking if percentage key exists in JSON")
12student = json.loads(studentJson)
13if "percentage" in student:
14 print("Key exist in JSON data")
15 print(student["name"], "marks is: ", student["percentage"])
16else:
17 print("Key doesn't exist in JSON data")