package utils import ( "encoding/json" "os" ) func LoadJsonTestData[T any](testDataPath string) (T, error) { // Create a variable to store the decoded JSON data var jsonData T // Open the JSON file file, err := os.Open(testDataPath) if err != nil { return jsonData, err } defer file.Close() // Create a decoder decoder := json.NewDecoder(file) // Decode the JSON data into the struct if err := decoder.Decode(&jsonData); err != nil { return jsonData, err } return jsonData, nil }