File size: 444 Bytes
51d42b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import json
print("This program will validate the JSON training data.")
file = input("Enter the file name with extension: ")
# Load the JSON file
with open(file, "r", encoding="utf8") as f:
data = json.load(f)
# Check each item in the JSON file
for item in data:
if "instruction" not in item or "input" not in item or "output" not in item:
print("Error: Missing key in JSON item.")
print(item)
print("File done. ")
|