package jsonload

import (
	"encoding/json"
	"os"

	"leafstalk/log"
)

func LoadJsonFile(filePath string, val interface{}) {
	ptrFile, err := os.Open(filePath)
	if err != nil {
		log.Fatalln("读取json文件失败", err)
	}
	defer ptrFile.Close()

	decoder := json.NewDecoder(ptrFile)
	err = decoder.Decode(val)
	if err != nil {
		log.Fatalln("loadJsonFile Decoder failed ", filePath, err.Error())
	} else {
		log.Infoln("loadJsonFile Decoder success ", filePath)
	}
}
