check if key exist in json object 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 check if key exist in json
json_string = """{"a": 1, "b": 2, "c": 3}"""
a_dictionary = json.loads(json_string)
b_in_dict = "b" in a_dictionary