Sign in
go
/
website
/
249c6aeddfb3f505c11ee701ca7590f8d3e928af
/
.
/
_content
/
talks
/
2015
/
tricks
/
json-encode.go
blob: a7aab97cc5d5a1072a9c5f55fe63ea278fff6035 [
file
] [
log
] [
blame
]
// +build ignore
package main
import (
"encoding/json"
"fmt"
"log"
)
func main() {
b, err := json.Marshal(struct {
ID int
Name string
}{42, "The answer"})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", b)
}