2016-04-02 31 views

回答

2

你可以編碼數據結構使用編碼/ JSON包這樣

package main 

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

func main() { 
    group := map[string]interface{} { 
     "name": "John Doe", 
     "age": 112, 
    } 
    b, err := json.Marshal(group) // this converts the structure into json 
    if err != nil { 
     fmt.Println("error:", err) 
    } 
    os.Stdout.Write(b) 
} 

golang json package