check if data exists in json python

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)

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe to get the latest posts sent to your email.



Leave a Reply

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe now to keep reading and get access to the full archive.

Continue reading