package services

import (
	"encoding/json"
	"fmt"
	"io"
	"os"
)

func readJson() []Server {
	// Open our jsonFile
	jsonFile, err := os.Open("servers.json")
	// if we os.Open returns an error then handle it
	if err != nil {
		fmt.Println(err)
	}

	defer jsonFile.Close()

	byteValue, _ := io.ReadAll(jsonFile)

	var servers []Server

	json.Unmarshal(byteValue, &servers)

	return servers
}
