how to check if python json has a field exist code example
Example 1: 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
Example 2: how to check if json has a key python
b_in_dict = "b" in a_dictionary