json object check if key exists code example
Example 1: check if key exists in json typescript
if (cell.hasOwnProperty('Relationships')) {
console.log("Key Found!!");
}
else {
console.log("Not Found.");
}
Example 2: python json check if key exist
if 'to' not in data:
raise ValueError("No target in given data")
if 'data' not in data['to']:
raise ValueError("No data for target")