package main
import (
"encoding/json"
"fmt"
)
//func Unmarshal(data []byte,v interface{}) error
//func Marshal(v interface{}) ([]byte,error)
func main() {
fmt.Println("go")
//简单的反解json
aBook := make(map[string]interface{})
aBook["name"] = "空"
aBook["price"] = 11.2
aBook["pub_age"] = 11
jstr,err := json.Marshal(aBook)
if err != nil {
fmt.Println("json encode faild")
return
}
fmt.Println(jstr,string(jstr))
jstr2 := make(map[string]interface{})
err = json.Unmarshal(jstr,&jstr2)
if err != nil {
fmt.Println("json decode faild")
return
}
fmt.Println(jstr2)
}