阅读目录
package main
import (
"encoding/json"
"fmt"
)
type Vertex struct {
X int
Y int
}
func main() {
//fmt.Println(Vertex{1, 2})
cfgJSON, _ := json.Marshal(Vertex{
1, 2})
// 打印 JSON 格式的字符串
fmt.Println("========start=====", string(cfgJSON), "========end=======")
}
========start===== {"X":1,"Y":2} ========end=======