crear json en Go

package main
 
import (
    "fmt"
    "encoding/json"
)
 
type Book struct {
    Name string
    Author string
}
 
func main() {
    book := Book{"C++ programming language", "Bjarne Stroutsrup"}
    res, err := json.Marshal(book)
     
    if err != nil {
        fmt.Println(err)
    }
     
    fmt.Println(string(res))      // {"Name":"C++ programming language","Author":"Bjarne Stroutsrup"}
}

// See more in the source
Grieving Gaur