I have JSON Array like this:
data = """ [
{
"id": 1,
"name": "crm/index",
"description": "CRM/Dashboard"
},
{
"id": 2,
"name": "crm/index/with_search",
"description": "CRM/Global Search"
}
]"""
Now, I have to verify that within this json three keys i.e. 'id', 'name' and 'description' are displaying throughout.
I have used following method:
student = json.loads(data)
if "id" in student:
print("Key exist in JSON data")
else:
print("Key doesn't exist in JSON data")
But it is returning me else statment, I need to know, where I am making mistake.