new_data = {"text":text }
with open("data.json",'r+') as file:
file_data = json.load(file)
if text in file_data["details"].__str__():
print(True)
else:
file_data["details"].append(new_data)
file.seek(0)
json.dump(file_data, file, indent = 4)
check if data exists in json python
August 7, 2024 in Python