For example :
client_json = {
"data": [
{
"attributes": {
"creators": [
{
"name": "This is a person",
"nameType": "Personal",
"givenName": "the",
"familyName": "person"
},
{
"name": "This is an organization",
"nameType": "Organizational",
"givenName": "the",
"familyName": "organization"
}
]
}
}
]
}
In above json I want to check if keys exists for this json path $.[0].attributes.creators[0].name,
I'm not worried about value.
Can I do that with jsonpath-ng
? I have used jsonpath
library by Stefan Goessner previously but that is old now.
I want something in python which is similar to this but doesexist()
As far as I know, you wouldn't have to use any sort of libraries to do a lookup. Since Python handles JSON like dictionaries. This is what I would try: