Answers for "if the json object has the key python3"

1

if the json object has the key python3

import json

studentJson ="""{
   "id": 1,
   "name": "john wick",
   "class": 8,
   "percentage": 75,
   "email": "[email protected]"
}"""

print("Checking if percentage key exists in JSON")
student = json.loads(studentJson)
if "percentage" in student:
    print("Key exist in JSON data")
    print(student["name"], "marks is: ", student["percentage"])
else:
    print("Key doesn't exist in JSON data")
Posted by: Guest on May-25-2021

Code answers related to "if the json object has the key python3"

Code answers related to "Javascript"

Browse Popular Code Answers by Language