阅读背景:

golang读取json文件内容_sinat_35850783的博客_golang 读取json文件

来源:互联网 
import (
	"os"
	"encoding/json"
	"io"
)
func readJons(){
	f , err := os.Open("./file.json")
	if err != nil {
	 	panic(err)
	 }
	 r :=io.Reader(f)
	 ret := &myStruct{}
	 if err = json.NewDecoder(r).Decode(ret); err != nil{
	 	panic(err)
	 }
	 return ret
 }
import (
	"os"
	"encoding/json"
	"io"
)



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: